]> code.delx.au - gnu-emacs/commitdiff
-
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 9 Feb 2016 22:26:40 +0000 (14:26 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 9 Feb 2016 22:26:40 +0000 (14:26 -0800)
1  2 
CONTRIBUTE
etc/NEWS
lisp/net/shr.el
src/alloc.c
src/lisp.h

diff --combined CONTRIBUTE
index 7fdfeb0f4657d8647b0c7dd0d825dde3a04df3d8,5a5cb5db5a52036f22eb41fc13b08dbb7cf68cac..71bbebb7da7ea15b59772c01cda34336184f229e
@@@ -224,17 -224,6 +224,17 @@@ the tracker with the corresponding bugs
  GNU ELPA has a 'debbugs' package that allows accessing the tracker
  database from Emacs.
  
 +Bugs needs regular attention.  A large backlog of bugs is
 +disheartening to the developers, and a culture of ignoring bugs is
 +harmful to users, who expect software that works.  Bugs have to be
 +regularly looked at and acted upon.  Not all bugs are critical, but at
 +the least, each bug needs to be regularly re-reviewed to make sure it
 +is still reproducible.
 +
 +The process of going through old or new bugs and acting on them is
 +called bug triage.  This process is described in the file
 +admin/notes/bug-triage.
 +
  ** Document your changes.
  
  Any change that matters to end-users should have an entry in etc/NEWS.
@@@ -267,9 -256,9 +267,9 @@@ If your test lasts longer than some fe
  
  To run tests on the entire Emacs tree, run "make check" from the
  top-level directory.  Most tests are in the directory
 -"test/automated".  From the "test/automated" directory, run "make
 +"test/".  From the "test/" directory, run "make
  <filename>" to run the tests for <filename>.el(c).  See
 -"test/automated/Makefile" for more information.
 +"test/Makefile" for more information.
  
  Tests which are tagged ":expensive-test" are enabled additionally, if
  you run "make check-expensive" from the top-level directory.  "make
  line. So "make check SELECTOR=nil" is equivalent to "make
  check-expensive".
  
+ You could also use predefined selectors of the Makefile. "make
+ <filename> SELECTOR='$(SELECTOR_DEFAULT)'" runs all tests for
+ <filename>.el(c) except the tests tagged as expensive.
+ Selectors can be defined with different methods, see (info "(ert)Test
+ Selectors") or
+ https://www.gnu.org/software/emacs/manual/html_node/ert/Test-Selectors.html
+ If your test file contains the tests "test-foo", "test2-foo" and
+ "test-foo-remote", and you want to run only the former two tests, you
+ could use a regexp: "make <filename> SELECTOR='\"foo$$\"'" .
  ** Understanding Emacs Internals.
  
  The best way to understand Emacs Internals is to read the code,
diff --combined etc/NEWS
index f0a3bec4525c426bb51c23831e97bd6286eedaf5,70f9476e71e216ae59856cd32d10e08080c61198..750d671cc6372e0e34c1463955d5ec3b27f3737d
+++ b/etc/NEWS
@@@ -22,75 -22,6 +22,75 @@@ Temporary note
  When you add a new item, use the appropriate mark if you are sure it applies,
  otherwise leave it unmarked.
  
 +\f
 +* Installation Changes in Emacs 25.2
 +
 +\f
 +* Startup Changes in Emacs 25.2
 +
 +\f
 +* Changes in Emacs 25.2
 +
 +** It is possible to disable attempted recovery on fatal signals
 +
 +Two new variables allow to disable attempts to recover from stack
 +overflow and to avoid automatic auto-save when Emacs is delivered a
 +fatal signal.  `attempt-stack-overflow-recovery', if set to `nil',
 +will disable attempts to recover from C stack overflows; Emacs will
 +then crash as with any other fatal signal.
 +`attempt-orderly-shutdown-on-fatal-signal', if set to `nil', will
 +disable attempts to auto-save the session and shut down in an orderly
 +fashion when Emacs receives a fatal signal; instead, Emacs will
 +terminate immediately.  Both variables are non-`nil' by default.
 +These variables are for users who would like to avoid the small
 +probability of data corruption due to techniques Emacs uses to recover
 +in these situations.
 +
 +\f
 +* Editing Changes in Emacs 25.2
 +
 +\f
 +* Changes in Specialized Modes and Packages in Emacs 25.2
 +
 +** eww
 +
 ++++
 +*** A new `s' command for switching to another eww buffer via the minibuffer.
 +
 ++++
 +** The commands that add ChangeLog entries now prefer a VCS root directory
 +for the ChangeLog file, if none already exists.  Customize
 +`change-log-directory-files' to nil for the old behavior.
 +
 +---
 +** Support for non-string values of `time-stamp-format' has been removed.
 +
 +** Tramp
 +
 ++++
 +*** New connection method "sg", which allows to edit files under
 +different group ID.
 +
 ++++
 +*** New connection method "doas" for OpenBSD hosts.
 +
 +\f
 +* New Modes and Packages in Emacs 25.2
 +
 +\f
 +* Incompatible Lisp Changes in Emacs 25.2
 +
 +\f
 +* Lisp Changes in Emacs 25.2
 +
 +** New var syntax-ppss-table to control the syntax-table used in syntax-ppss
 +
 +** Autoload files can be generated without timestamps,
 +by setting `autoload-timestamps' to nil.
 +
 +\f
 +* Changes in Emacs 25.2 on Non-Free Operating Systems
 +
  \f
  * Installation Changes in Emacs 25.1
  
@@@ -249,33 -180,17 +249,33 @@@ change in future releases.  For that re
  by default, and must be enabled by using the `--with-modules' option
  at configure time.
  
 ++++
 +** A second dir-local file (.dir-locals-2.el) is now accepted.
 +See the variable `dir-locals-file-2' for more information.
 +
  +++
  ** Network security (TLS/SSL certificate validity and the like) is
  added via the new Network Security Manager (NSM) and controlled via
  the `network-security-level' variable.
  
 +---
 +** International domain names (IDNA) are now encoded via the new
 +puny.el library, so that one can visit web sites like
 +"http://méxico.icom.museum".
 +
  +++
  ** C-h l now also lists the commands that were run.
  
 +** The new M-s M-w key binding uses eww to search the web for the
 +text in the region.
 +
  +++
 -** x-select-enable-clipboard is renamed select-enable-clipboard
 -and x-select-enable-primary is renamed select-enable-primary.
 +** The new `timer-list' command lists all active timers in a buffer
 +where you can cancel them with the `c' command.
 +
 +** M-x suggests shorthands and ignores obsolete commands for completion.
 +** x-select-enable-clipboard is renamed select-enable-clipboard.
 +x-select-enable-primary and renamed select-enable-primary.
  Additionally they both now apply to all systems (OSX, GNUstep, Windows, you
  name it), with the proviso that on some systems (e.g. Windows)
  select-enable-primary is ineffective since the system doesn't
@@@ -290,10 -205,6 +290,10 @@@ selected window is strongly dedicated t
  ** The option `even-window-heights' has been renamed to
  `even-window-sizes' and now handles window widths as well.
  
 ++++
 +** New function `read-multiple-choice' use to prompt for
 +multiple-choice questions, with a handy way to display help texts.
 +
  +++
  ** terpri gets an optional arg ENSURE to conditionally output a newline.
  
@@@ -316,6 -227,14 +316,6 @@@ for use in Emacs bug reports
  hiding character but the default `.' can be used by let-binding the
  variable `read-hide-char'.
  
 -+++
 -** The Emacs pseudo-random number generator can be securely seeded.
 -On system where Emacs can access the system entropy or some other
 -cryptographically secure random stream, it now uses that when `random'
 -is called with its argument `t'.  This allows cryptographically strong
 -random values; in particular, the Emacs server now uses this facility
 -to produce its authentication key.
 -
  ---
  ** New input methods: `tamil-dvorak' and `programmer-dvorak'.
  
@@@ -434,6 -353,20 +434,20 @@@ to version 206, you can do this with C-
  It raises an error if a bookmark of that name already exists,
  unlike `bookmark-set' which silently updates an existing bookmark.
  
+ ** Gnus
+ +++
+ *** New user options `mm-html-inhibit-images' and `mm-html-blocked-images'
+ now control how mm-* functions fetch and display images in an HTML
+ message.  Gnus still uses `gnus-inhibit-images' and `gnus-blocked-images'
+ for that purpose, i.e., binds mm-html- variables with those gnus-
+ variables, but other packages do not have to bind gnus- variables now.
+ ---
+ *** `mm-inline-text-html-with-images' has been removed.
+ Use `mm-html-inhibit-images' instead.  Note that the value is opposite
+ in meaning.
  ** IMAP
  
  ---
@@@ -511,9 -444,6 +525,9 @@@ additionally need to add `getSelection
  `erc-network-hide-list' and `erc-channel-hide-list' will only hide the
  specified message types for the respective specified targets.
  
 +*** New variable `erc-default-port-tls' used to connect to TLS IRC
 +servers.
 +
  ---
  *** Reconnection is now asynchronous.
  
@@@ -749,11 -679,6 +763,11 @@@ useful when, for example, one needs to 
  whether to use variable-pitch fonts or not.  The user can also
  customize the `shr-use-fonts' variable.
  
 ++++
 +*** A new command `C' (`eww-toggle-colors') can be used to toggle
 +whether to use the HTML-specified colors or not.  The user can also
 +customize the `shr-use-colors' variable.
 +
  +++
  *** A new command `R' (`eww-readable') will try do identify the main
  textual parts of a web page and display only that, leaving menus and
@@@ -798,22 -723,6 +812,22 @@@ invalid certificates are marked in red
  *** text/html messages that contain inline image parts will be
  transformed into multipart/related messages before sending.
  
 +---
 +*** The `message-valid-fqdn-regexp' variable has been removed, since
 +there are now top-level domains added all the time.  Message will no
 +longer warn about sending emails to top-level domains it hasn't heard
 +about.
 +
 +*** `message-beginning-of-line' (bound to C-a) understands folded headers.
 +In `visual-line-mode' it will look for the true beginning of a header
 +while in non-`visual-line-mode' it will move the point to the indented
 +header’s value.
 +
 ++++
 +** Images are automatically scaled before displaying based on the
 +`image-scaling-factor' variable (if Emacs supports scaling the images
 +in question).
 +
  +++
  ** In Show Paren Mode, a parenthesis can be highlighted when point
  stands inside it, and certain parens can be highlighted when point is
@@@ -912,8 -821,6 +926,8 @@@ to produce a neat summary
  
  ---
  ** New js.el option `js-indent-first-init'.
 +It was renamed from `js-indent-first-initialiser', to avoid issues
 +with American vs British spelling.
  
  ** Info
  
@@@ -1062,6 -969,11 +1076,11 @@@ comparing with the next window, customi
  replace the face `compare-windows', which is now an obsolete alias for
  `compare-windows-added'.
  
+ ---
+ *** The VC state indicator in the mode line now has different faces
+ corresponding to each of the possible states. See the `vc-faces'
+ customization group.
  ---
  *** `log-edit-insert-changelog' converts "(tiny change)" to
  "Copyright-paperwork-exempt: yes".  Set `log-edit-rewrite-tiny-change'
@@@ -1311,9 -1223,6 +1330,9 @@@ compression command is determined from 
  `dired-compress-files-alist' variable.
  
  +++
 +*** `W' is now bound to `browse-url-of-dired-file', and is useful for
 +viewing HTML files and the like.
 +
  *** New user interface for the `A' and `Q' commands.
  These keys, now bound to `dired-do-find-regexp' and
  `dired-do-find-regexp-and-replace', work similarly to `xref-find-apropos'
@@@ -1408,6 -1317,14 +1427,6 @@@ eliminated
  Removed font-lock-beginning-of-syntax-function and the SYNTAX-BEGIN
  slot in font-lock-defaults.
  
 -+++
 -** The new implementation of Subword mode affects word movement everywhere.
 -When Subword mode is turned on, `forward-word', `backward-word', and
 -everything that uses them will move by sub-words, effectively
 -overriding the buffer's syntax table.  Lisp programs that shouldn't be
 -affected by Subword mode should call the new functions
 -`forward-word-strictly' and `backward-word-strictly' instead.
 -
  +++
  ** `package-initialize' now sets `package-enable-at-startup' to nil if
  called during startup.  Users who call this function in their init
diff --combined lisp/net/shr.el
index 567c8b807ff5a5b1857f36688bff715cfeba3ee4,66a9c04a8f6acec01c319529e54334d7d5286b95..9064b9668f4edcb2ed5acbbe0af095bf843e5fe0
@@@ -64,12 -64,6 +64,12 @@@ fit these criteria.
    :group 'shr
    :type 'boolean)
  
 +(defcustom shr-use-colors t
 +  "If non-nil, respect color specifications in the HTML."
 +  :version "25.2"
 +  :group 'shr
 +  :type 'boolean)
 +
  (defcustom shr-table-horizontal-line nil
    "Character used to draw horizontal table lines.
  If nil, don't draw horizontal table lines."
@@@ -142,14 -136,6 +142,14 @@@ cid: URL as the argument."
  (defvar shr-inhibit-images nil
    "If non-nil, inhibit loading images.")
  
 +(defvar shr-external-rendering-functions nil
 +  "Alist of tag/function pairs used to alter how shr renders certain tags.
 +For instance, eww uses this to alter rendering of title, forms
 +and other things:
 +((title . eww-tag-title)
 + (form . eww-tag-form)
 + ...)")
 +
  ;;; Internal variables.
  
  (defvar shr-folding-mode nil)
  (defvar shr-depth 0)
  (defvar shr-warning nil)
  (defvar shr-ignore-cache nil)
 -(defvar shr-external-rendering-functions nil)
  (defvar shr-target-id nil)
  (defvar shr-table-separator-length 1)
  (defvar shr-table-separator-pixel-width 0)
@@@ -448,10 -435,11 +448,10 @@@ size, and full-buffer size.
  
  (defun shr-descend (dom)
    (let ((function
 -       (or
 -        ;; Allow other packages to override (or provide) rendering
 -        ;; of elements.
 -        (cdr (assq (dom-tag dom) shr-external-rendering-functions))
 -        (intern (concat "shr-tag-" (symbol-name (dom-tag dom))) obarray)))
 +         (intern (concat "shr-tag-" (symbol-name (dom-tag dom))) obarray))
 +        ;; Allow other packages to override (or provide) rendering
 +        ;; of elements.
 +        (external (cdr (assq (dom-tag dom) shr-external-rendering-functions)))
        (style (dom-attr dom 'style))
        (shr-stylesheet shr-stylesheet)
        (shr-depth (1+ shr-depth))
          (setq style nil)))
        ;; If we have a display:none, then just ignore this part of the DOM.
        (unless (equal (cdr (assq 'display shr-stylesheet)) "none")
 -      (if (fboundp function)
 -          (funcall function dom)
 -        (shr-generic dom))
 +        (cond (external
 +               (funcall external dom))
 +              ((fboundp function)
 +               (funcall function dom))
 +              (t
 +               (shr-generic dom)))
        (when (and shr-target-id
                   (equal (dom-attr dom 'id) shr-target-id))
          ;; If the element was empty, we don't have anything to put the
@@@ -1109,9 -1094,7 +1109,9 @@@ ones, in case fg and bg are nil.
                 (shr-color-visible bg fg)))))))
  
  (defun shr-colorize-region (start end fg &optional bg)
 -  (when (and (or fg bg) (>= (display-color-cells) 88))
 +  (when (and shr-use-colors
 +             (or fg bg)
 +             (>= (display-color-cells) 88))
      (let ((new-colors (shr-color-check fg bg)))
        (when new-colors
        (when fg
  (defun shr-tag-s (dom)
    (shr-fontize-dom dom 'shr-strike-through))
  
 -(defun shr-tag-del (dom)
 -  (shr-fontize-dom dom 'shr-strike-through))
 -
  (defun shr-tag-b (dom)
    (shr-fontize-dom dom 'bold))
  
    (let ((shr-current-font 'default))
      (shr-generic dom)))
  
 +(defun shr-tag-ins (cont)
 +  (let* ((start (point))
 +         (color "green")
 +         (shr-stylesheet (nconc (list (cons 'color color))
 +                              shr-stylesheet)))
 +    (shr-generic cont)
 +    (shr-colorize-region start (point) color
 +                         (cdr (assq 'background-color shr-stylesheet)))))
 +
 +(defun shr-tag-del (cont)
 +  (let* ((start (point))
 +         (color "red")
 +         (shr-stylesheet (nconc (list (cons 'color color))
 +                              shr-stylesheet)))
 +    (shr-fontize-dom cont 'shr-strike-through)
 +    (shr-colorize-region start (point) color
 +                         (cdr (assq 'background-color shr-stylesheet)))))
 +
  (defun shr-parse-style (style)
    (when style
      (save-match-data
@@@ -1818,13 -1786,15 +1818,15 @@@ The preference is a float determined fr
  
  (defun shr-face-background (face)
    (and (consp face)
-        (let ((background nil))
-        (dolist (elem face)
-          (when (and (consp elem)
-                     (eq (car elem) :background))
-            (setq background (cadr elem))))
-        (and background
-             (list :background background)))))
+        (or (and (plist-get face :background)
+                 (list :background (plist-get face :background)))
+            (let ((background nil))
+              (dolist (elem face)
+                (when (and (consp elem)
+                           (eq (car elem) :background))
+                  (setq background (cadr elem))))
+              (and background
+                   (list :background background))))))
  
  (defun shr-expand-alignments (start end)
    (while (< (setq start (next-single-property-change
diff --combined src/alloc.c
index 81cfdb011dcdefc216b695e8a5c66d3703d5eb06,6bc1b8afe17c27171a97d993ac2dc41c73c9d472..5ee1cc340a5dc7dde06239a0773f816de35ff97e
@@@ -22,7 -22,10 +22,7 @@@ along with GNU Emacs.  If not, see <htt
  
  #include <stdio.h>
  #include <limits.h>           /* For CHAR_BIT.  */
 -
 -#ifdef ENABLE_CHECKING
 -#include <signal.h>           /* For SIGABRT.  */
 -#endif
 +#include <signal.h>           /* For SIGABRT, SIGDANGER.  */
  
  #ifdef HAVE_PTHREAD
  #include <pthread.h>
@@@ -32,7 -35,6 +32,7 @@@
  #include "dispextern.h"
  #include "intervals.h"
  #include "puresize.h"
 +#include "sheap.h"
  #include "systime.h"
  #include "character.h"
  #include "buffer.h"
  #include "dosfns.h"           /* For dos_memory_info.  */
  #endif
  
 +#ifdef HAVE_MALLOC_H
 +# include <malloc.h>
 +#endif
 +
  #if (defined ENABLE_CHECKING                  \
       && defined HAVE_VALGRIND_VALGRIND_H      \
       && !defined USE_VALGRIND)
@@@ -108,6 -106,8 +108,6 @@@ my_heap_start (void
  
  #ifdef DOUG_LEA_MALLOC
  
 -#include <malloc.h>
 -
  /* Specify maximum number of areas to mmap.  It would be nice to use a
     value that explicitly means "no limit".  */
  
     inside glibc's malloc.  */
  static void *malloc_state_ptr;
  
 -/* Get and free this pointer; useful around unexec.  */
 -void
 -alloc_unexec_pre (void)
 -{
 -  malloc_state_ptr = malloc_get_state ();
 -}
 -void
 -alloc_unexec_post (void)
 -{
 -  free (malloc_state_ptr);
 -}
 -
  /* Restore the dumped malloc state.  Because malloc can be invoked
     even before main (e.g. by the dynamic linker), the dumped malloc
     state must be restored as early as possible using this special hook.  */
@@@ -157,40 -169,14 +157,40 @@@ malloc_initialize_hook (void
      }
  }
  
 +/* Declare the malloc initialization hook, which runs before 'main' starts.
 +   EXTERNALLY_VISIBLE works around Bug#22522.  */
  # ifndef __MALLOC_HOOK_VOLATILE
  #  define __MALLOC_HOOK_VOLATILE
  # endif
 -voidfuncptr __MALLOC_HOOK_VOLATILE __malloc_initialize_hook
 +voidfuncptr __MALLOC_HOOK_VOLATILE __malloc_initialize_hook EXTERNALLY_VISIBLE
    = malloc_initialize_hook;
  
  #endif
  
 +/* Allocator-related actions to do just before and after unexec.  */
 +
 +void
 +alloc_unexec_pre (void)
 +{
 +#ifdef DOUG_LEA_MALLOC
 +  malloc_state_ptr = malloc_get_state ();
 +#endif
 +#ifdef HYBRID_MALLOC
 +  bss_sbrk_did_unexec = true;
 +#endif
 +}
 +
 +void
 +alloc_unexec_post (void)
 +{
 +#ifdef DOUG_LEA_MALLOC
 +  free (malloc_state_ptr);
 +#endif
 +#ifdef HYBRID_MALLOC
 +  bss_sbrk_did_unexec = false;
 +#endif
 +}
 +
  /* Mark, unmark, query mark bit of a Lisp string.  S must be a pointer
     to a struct Lisp_String.  */
  
@@@ -564,8 -550,6 +564,8 @@@ static struct Lisp_Finalizer doomed_fin
                                Malloc
   ************************************************************************/
  
 +#if defined SIGDANGER || (!defined SYSTEM_MALLOC && !defined HYBRID_MALLOC)
 +
  /* Function malloc calls this if it finds we are near exhausting storage.  */
  
  void
@@@ -574,7 -558,6 +574,7 @@@ malloc_warning (const char *str
    pending_malloc_warning = str;
  }
  
 +#endif
  
  /* Display an already-pending malloc warning.  */
  
@@@ -1128,14 -1111,23 +1128,14 @@@ lisp_free (void *block
     unexmacosx.c, so don't use it on Darwin.  */
  
  #if ! ADDRESS_SANITIZER && !defined DARWIN_OS
 -# if !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC
 -#  define USE_ALIGNED_ALLOC 1
 -#  ifndef HAVE_ALIGNED_ALLOC
 -/* Defined in gmalloc.c.  */
 -void *aligned_alloc (size_t, size_t);
 -#  endif
 -# elif defined HYBRID_MALLOC
 -#  if defined HAVE_ALIGNED_ALLOC || defined HAVE_POSIX_MEMALIGN
 -#   define USE_ALIGNED_ALLOC 1
 -#   define aligned_alloc hybrid_aligned_alloc
 -/* Defined in gmalloc.c.  */
 -void *aligned_alloc (size_t, size_t);
 -#  endif
 -# elif defined HAVE_ALIGNED_ALLOC
 +# if (defined HAVE_ALIGNED_ALLOC                                      \
 +      || (defined HYBRID_MALLOC                                               \
 +        ? defined HAVE_POSIX_MEMALIGN                                 \
 +        : !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC))
  #  define USE_ALIGNED_ALLOC 1
 -# elif defined HAVE_POSIX_MEMALIGN
 +# elif !defined HYBRID_MALLOC && defined HAVE_POSIX_MEMALIGN
  #  define USE_ALIGNED_ALLOC 1
 +#  define aligned_alloc my_aligned_alloc /* Avoid collision with lisp.h.  */
  static void *
  aligned_alloc (size_t alignment, size_t size)
  {
@@@ -1383,12 -1375,25 +1383,25 @@@ lisp_align_free (void *block
  static bool
  laligned (void *p, size_t size)
  {
-   return (MALLOC_IS_GC_ALIGNED || size % GCALIGNMENT != 0
-         || (intptr_t) p % GCALIGNMENT == 0);
+   return (MALLOC_IS_GC_ALIGNED || (intptr_t) p % GCALIGNMENT == 0
+         || size % GCALIGNMENT != 0);
  }
  
  /* Like malloc and realloc except that if SIZE is Lisp-aligned, make
-    sure the result is too.  */
+    sure the result is too, if necessary by reallocating (typically
+    with larger and larger sizes) until the allocator returns a
+    Lisp-aligned pointer.  Code that needs to allocate C heap memory
+    for a Lisp object should use one of these functions to obtain a
+    pointer P; that way, if T is an enum Lisp_Type value and L ==
+    make_lisp_ptr (P, T), then XPNTR (L) == P and XTYPE (L) == T.
+    On typical modern platforms these functions' loops do not iterate.
+    On now-rare (and perhaps nonexistent) platforms, the loops in
+    theory could repeat forever.  If an infinite loop is possible on a
+    platform, a build would surely loop and the builder can then send
+    us a bug report.  Adding a counter to try to detect any such loop
+    would complicate the code (and possibly introduce bugs, in code
+    that's never really exercised) for little benefit.  */
  
  static void *
  lmalloc (size_t size)
        if (laligned (p, size))
        break;
        free (p);
+       size_t bigger;
+       if (! INT_ADD_WRAPV (size, GCALIGNMENT, &bigger))
+       size = bigger;
      }
  
    eassert ((intptr_t) p % GCALIGNMENT == 0);
  static void *
  lrealloc (void *p, size_t size)
  {
-   do
-     p = realloc (p, size);
-   while (! laligned (p, size));
+   while (true)
+     {
+       p = realloc (p, size);
+       if (laligned (p, size))
+       break;
+       size_t bigger;
+       if (! INT_ADD_WRAPV (size, GCALIGNMENT, &bigger))
+       size = bigger;
+     }
  
    eassert ((intptr_t) p % GCALIGNMENT == 0);
    return p;
@@@ -3377,13 -3391,22 +3399,13 @@@ allocate_buffer (void
  DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0,
         doc: /* Return a newly created vector of length LENGTH, with each element being INIT.
  See also the function `vector'.  */)
 -  (register Lisp_Object length, Lisp_Object init)
 +  (Lisp_Object length, Lisp_Object init)
  {
 -  Lisp_Object vector;
 -  register ptrdiff_t sizei;
 -  register ptrdiff_t i;
 -  register struct Lisp_Vector *p;
 -
    CHECK_NATNUM (length);
 -
 -  p = allocate_vector (XFASTINT (length));
 -  sizei = XFASTINT (length);
 -  for (i = 0; i < sizei; i++)
 +  struct Lisp_Vector *p = allocate_vector (XFASTINT (length));
 +  for (ptrdiff_t i = 0; i < XFASTINT (length); i++)
      p->contents[i] = init;
 -
 -  XSETVECTOR (vector, p);
 -  return vector;
 +  return make_lisp_ptr (p, Lisp_Vectorlike);
  }
  
  DEFUN ("vector", Fvector, Svector, 0, MANY, 0,
@@@ -3392,9 -3415,12 +3414,9 @@@ Any number of arguments, even zero argu
  usage: (vector &rest OBJECTS)  */)
    (ptrdiff_t nargs, Lisp_Object *args)
  {
 -  ptrdiff_t i;
 -  register Lisp_Object val = make_uninit_vector (nargs);
 -  register struct Lisp_Vector *p = XVECTOR (val);
 -
 -  for (i = 0; i < nargs; i++)
 -    p->contents[i] = args[i];
 +  Lisp_Object val = make_uninit_vector (nargs);
 +  struct Lisp_Vector *p = XVECTOR (val);
 +  memcpy (p->contents, args, nargs * sizeof *args);
    return val;
  }
  
@@@ -3433,8 -3459,9 +3455,8 @@@ stack before executing the byte-code
  usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS)  */)
    (ptrdiff_t nargs, Lisp_Object *args)
  {
 -  ptrdiff_t i;
 -  register Lisp_Object val = make_uninit_vector (nargs);
 -  register struct Lisp_Vector *p = XVECTOR (val);
 +  Lisp_Object val = make_uninit_vector (nargs);
 +  struct Lisp_Vector *p = XVECTOR (val);
  
    /* We used to purecopy everything here, if purify-flag was set.  This worked
       OK for Emacs-23, but with Emacs-24's lexical binding code, it can be
       just wasteful and other times plainly wrong (e.g. those free vars may want
       to be setcar'd).  */
  
 -  for (i = 0; i < nargs; i++)
 -    p->contents[i] = args[i];
 +  memcpy (p->contents, args, nargs * sizeof *args);
    make_byte_code (p);
    XSETCOMPILED (val, p);
    return val;
diff --combined src/lisp.h
index f71394e878495d0167256989e4ec2e6b6de28042,af73c4b15ce808726af5ff3bcf147974a39aab8c..2221acd5827dcf4443227121bc318d754d58867c
@@@ -262,10 -262,6 +262,6 @@@ DEFINE_GDB_SYMBOL_END (USE_LSB_TAG
  error !;
  #endif
  
- #ifndef alignas
- # error "alignas not defined"
- #endif
  #ifdef HAVE_STRUCT_ATTRIBUTE_ALIGNED
  # define GCALIGNED __attribute__ ((aligned (GCALIGNMENT)))
  #else
@@@ -604,9 -600,7 +600,9 @@@ extern _Noreturn Lisp_Object wrong_type
  extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object);
  
  /* Defined in emacs.c.  */
 +#ifdef DOUG_LEA_MALLOC
  extern bool might_dump;
 +#endif
  /* True means Emacs has already been initialized.
     Used during startup to detect startup of dumped Emacs.  */
  extern bool initialized;
@@@ -3589,8 -3583,13 +3585,8 @@@ extern void mark_object (Lisp_Object)
  #if defined REL_ALLOC && !defined SYSTEM_MALLOC && !defined HYBRID_MALLOC
  extern void refill_memory_reserve (void);
  #endif
 -#ifdef DOUG_LEA_MALLOC
  extern void alloc_unexec_pre (void);
  extern void alloc_unexec_post (void);
 -#else
 -INLINE void alloc_unexec_pre (void) {}
 -INLINE void alloc_unexec_post (void) {}
 -#endif
  extern const char *pending_malloc_warning;
  extern Lisp_Object zero_vector;
  extern Lisp_Object *stack_base;
@@@ -3756,15 -3755,6 +3752,15 @@@ extern void check_cons_list (void)
  INLINE void (check_cons_list) (void) { lisp_h_check_cons_list (); }
  #endif
  
 +/* Defined in gmalloc.c.  */
 +#if !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC && !defined SYSTEM_MALLOC
 +extern size_t __malloc_extra_blocks;
 +#endif
 +#if !HAVE_DECL_ALIGNED_ALLOC
 +extern void *aligned_alloc (size_t, size_t) ATTRIBUTE_MALLOC_SIZE ((2));
 +#endif
 +extern void malloc_enable_thread (void);
 +
  #ifdef REL_ALLOC
  /* Defined in ralloc.c.  */
  extern void *r_alloc (void **, size_t) ATTRIBUTE_ALLOC_SIZE ((2));
@@@ -4245,7 -4235,9 +4241,7 @@@ struct tty_display_info
  struct terminal;
  
  /* Defined in sysdep.c.  */
 -#ifndef HAVE_GET_CURRENT_DIR_NAME
 -extern char *get_current_dir_name (void);
 -#endif
 +extern char *emacs_get_current_dir_name (void);
  extern void stuff_char (char c);
  extern void init_foreground_group (void);
  extern void sys_subshell (void);