use xmalloc_atomic for many pointerless objects
authorRobin Templeton <robin@terpri.org>
Mon, 30 Jun 2014 08:26:49 +0000 (04:26 -0400)
committerRobin Templeton <robin@terpri.org>
Sat, 18 Apr 2015 22:49:07 +0000 (18:49 -0400)
* src/alloc.c (make_float, memory_full, refill_memory_reserve):
* src/buffer.c (alloc_buffer_text):
* src/ccl.c (Fccl_execute_on_string):
* src/charset.c (Fdefine_charset_internal):
* src/coding.c (encode_coding_object):
* src/composite.c (get_composition_id):
* src/dispnew.c (adjust_frame_message_buffer):
* src/doc.c (Fsubstitute_command_keys):
* src/doprnt.c (doprnt):
* src/editfns.c (Fmessage, Fformat):
* src/emacs.c (sort_args):
* src/filelock.c (current_lock_owner):
* src/fns.c (Fstring_as_unibyte, Fstring_to_unibyte):
* src/ftfont.c (ftfont_get_open_type_spec):
* src/gtkutil.c (get_utf8_string):
* src/image.c (x_create_bitmap_from_file, x_create_bitmap_from_file)
  (x_create_x_image_and_pixmap, slurp_file, xbm_read_bitmap_data)
  (xpm_load, colors_in_color_table, pbm_read_file, png_load, tiff_load):
* src/keyboard.c (parse_tool_bar_item):
* src/lread.c (read1, init_obarray):
* src/minibuf.c (read_minibuf_noninteractive):
* src/print.c (PRINTPREPARE):
* src/search.c (Freplace_match, syms_of_search):
* src/sysdep.c (system_process_attributes):
* src/term.c (init_tty):
* src/termcap.c (tgetst1, tgetent)
* src/tparam.c (tparam1):
* src/widget.c (set_frame_size):
* src/xdisp.c (init_xdisp):
* src/xfns.c (x_encode_text, xic_create_fontsetname, x_window)
  (Fx_change_window_property):
* src/xrdb.c (x_get_customization_string, magic_file_p, gethomedir)
  (get_user_db):
* src/xselect.c (x_get_window_property, receive_incremental_selection):
* src/xsmfns.c (smc_save_yourself_CB, x_session_initialize):
* src/xterm.c (xim_initialize, x_term_init): Use xmalloc_atomic and
  related functions for allocating pointerless objects.

Conflicts:
src/alloc.c
src/editfns.c
src/fns.c
src/xterm.c

27 files changed:
src/alloc.c
src/buffer.c
src/ccl.c
src/charset.c
src/coding.c
src/composite.c
src/doc.c
src/doprnt.c
src/editfns.c
src/emacs.c
src/fns.c
src/ftfont.c
src/gtkutil.c
src/image.c
src/keyboard.c
src/lread.c
src/minibuf.c
src/print.c
src/search.c
src/termcap.c
src/tparam.c
src/xdisp.c
src/xfns.c
src/xrdb.c
src/xselect.c
src/xsmfns.c
src/xterm.c

index 366fd34..51ab850 100644 (file)
@@ -386,7 +386,7 @@ xstrdup (const char *s)
   ptrdiff_t size;
   eassert (s);
   size = strlen (s) + 1;
-  return memcpy (xmalloc (size), s, size);
+  return memcpy (xmalloc_atomic (size), s, size);
 }
 
 /* Like above, but duplicates Lisp string to C string.  */
@@ -395,7 +395,7 @@ char *
 xlispstrdup (Lisp_Object string)
 {
   ptrdiff_t size = SBYTES (string) + 1;
-  return memcpy (xmalloc (size), SSDATA (string), size);
+  return memcpy (xmalloc_atomic (size), SSDATA (string), size);
 }
 
 /* Assign to *PTR a copy of STRING, freeing any storage *PTR formerly
@@ -787,7 +787,7 @@ Lisp_Object
 make_float (double float_value)
 {
   register Lisp_Object val;
-  XSETFLOAT (val, xmalloc (sizeof (struct Lisp_Float)));
+  XSETFLOAT (val, xmalloc_atomic (sizeof (struct Lisp_Float)));
   XFLOAT_INIT (val, float_value);
   return val;
 }
@@ -1459,7 +1459,7 @@ memory_full (size_t nbytes)
   bool enough_free_memory = 0;
   if (SPARE_MEMORY < nbytes)
     {
-      void *p = xmalloc_unsafe (SPARE_MEMORY);
+      void *p = xmalloc_atomic_unsafe (SPARE_MEMORY);
       if (p)
        {
          xfree (p);
@@ -1495,7 +1495,7 @@ void
 refill_memory_reserve (void)
 {
   if (spare_memory == NULL)
-    spare_memory = xmalloc_unsafe (SPARE_MEMORY);
+    spare_memory = xmalloc_atomic_unsafe (SPARE_MEMORY);
 
   if (spare_memory)
     Vmemory_full = Qnil;
index d6f6b2c..2ec2061 100644 (file)
@@ -5010,7 +5010,7 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
 #elif defined REL_ALLOC
   p = r_alloc ((void **) &b->text->beg, nbytes);
 #else
-  p = xmalloc (nbytes);
+  p = xmalloc_atomic (nbytes);
 #endif
 
   if (p == NULL)
index 54093bf..6dedaf6 100644 (file)
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -2092,7 +2092,7 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
   outbufsize = (ccl.buf_magnification
                ? str_bytes * ccl.buf_magnification + 256
                : str_bytes + 256);
-  outp = outbuf = xmalloc (outbufsize);
+  outp = outbuf = xmalloc_atomic (outbufsize);
 
   consumed_chars = consumed_bytes = 0;
   produced_chars = 0;
index 341ac35..57437b8 100644 (file)
@@ -914,7 +914,7 @@ usage: (define-charset-internal ...)  */)
 
   if (! charset.code_linear_p)
     {
-      charset.code_space_mask = xzalloc (256);
+      charset.code_space_mask = xzalloc_atomic (256);
       for (i = 0; i < 4; i++)
        for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1];
             j++)
index 5dbaf96..3fffeb4 100644 (file)
@@ -8342,7 +8342,7 @@ encode_coding_object (struct coding_system *coding,
     {
       ptrdiff_t dst_bytes = max (1, coding->src_chars);
       coding->dst_object = Qnil;
-      coding->destination = xmalloc (dst_bytes);
+      coding->destination = xmalloc_atomic (dst_bytes);
       coding->dst_bytes = dst_bytes;
       coding->dst_multibyte = 0;
     }
index 66a2075..3dc715e 100644 (file)
@@ -327,7 +327,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars,
   cmp->method = method;
   cmp->hash_index = hash_index;
   cmp->glyph_len = glyph_len;
-  cmp->offsets = xnmalloc (glyph_len, 2 * sizeof *cmp->offsets);
+  cmp->offsets = xnmalloc_atomic (glyph_len, 2 * sizeof *cmp->offsets);
   cmp->font = NULL;
 
   if (cmp->method != COMPOSITION_WITH_RULE_ALTCHARS)
index df8cfba..d0b28f8 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -747,7 +747,7 @@ Otherwise, return a new string.  */)
   keymap = Voverriding_local_map;
 
   bsize = SBYTES (string);
-  bufp = buf = xmalloc (bsize);
+  bufp = buf = xmalloc_atomic (bsize);
 
   strp = SDATA (string);
   while (strp < SDATA (string) + SBYTES (string))
index cc4d0e4..3d50724 100644 (file)
@@ -250,7 +250,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
            {
              if (big_buffer)
                xfree (big_buffer);
-             big_buffer = xmalloc (size_bound);
+             big_buffer = xmalloc_atomic (size_bound);
              sprintf_buffer = big_buffer;
              size_allocated = size_bound;
            }
index 5bef151..8308d07 100644 (file)
@@ -4209,7 +4209,7 @@ usage: (format STRING &rest OBJECTS)  */)
 
        if (buf == initial_buffer)
          {
-           buf = xmalloc (bufsize);
+           buf = xmalloc_atomic (bufsize);
            sa_must_free = true;
            buf_save_value_index = SPECPDL_INDEX ();
            record_unwind_protect_ptr (xfree, buf);
index a79c68a..ad7442b 100644 (file)
@@ -1779,8 +1779,8 @@ sort_args (int argc, char **argv)
      0 for an option that takes no arguments,
      1 for an option that takes one argument, etc.
      -1 for an ordinary non-option argument.  */
-  int *options = xnmalloc (argc, sizeof *options);
-  int *priority = xnmalloc (argc, sizeof *priority);
+  int *options = xnmalloc_atomic (argc, sizeof *options);
+  int *priority = xnmalloc_atomic (argc, sizeof *priority);
   int to = 1;
   int incoming_used = 1;
   int from;
index a355dab..fd1568b 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -1054,7 +1054,7 @@ an error is signaled.  */)
   if (STRING_MULTIBYTE (string))
     {
       ptrdiff_t chars = SCHARS (string);
-      unsigned char *str = xmalloc (chars);
+      unsigned char *str = xmalloc_atomic (chars);
       ptrdiff_t converted = str_to_unibyte (SDATA (string), str, chars);
 
       if (converted < chars)
index f87d759..bea1e01 100644 (file)
@@ -693,7 +693,7 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec)
       spec->features[i] =
        (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XINT (len)
         ? 0
-        : xmalloc_unsafe (XINT (len) * sizeof *spec->features[i]));
+        : xmalloc_atomic_unsafe (XINT (len) * sizeof *spec->features[i]));
       if (! spec->features[i])
        {
          if (i > 0 && spec->features[0])
index e3d4406..558b727 100644 (file)
@@ -498,7 +498,7 @@ get_utf8_string (const char *str)
       len = strlen (str);
       if ((min (PTRDIFF_MAX, SIZE_MAX) - len - 1) / 4 < nr_bad)
        memory_full (SIZE_MAX);
-      up = utf8_str = xmalloc (len + nr_bad * 4 + 1);
+      up = utf8_str = xmalloc_atomic (len + nr_bad * 4 + 1);
       p = (unsigned char *)str;
 
       while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read,
index 24e1f3b..60caf84 100644 (file)
@@ -1920,7 +1920,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
     }
 
   /* Allocate image raster.  */
-  (*ximg)->data = xmalloc ((*ximg)->bytes_per_line * height);
+  (*ximg)->data = xmalloc_atomic ((*ximg)->bytes_per_line * height);
 
   /* Allocate a pixmap of the same size.  */
   *pixmap = XCreatePixmap (display, window, width, height, depth);
@@ -2788,7 +2788,7 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e
     }
   bytes_per_line = (*width + 7) / 8 + padding_p;
   nbytes = bytes_per_line * *height;
-  p = *data = xmalloc (nbytes);
+  p = *data = xmalloc_atomic (nbytes);
 
   if (v10)
     {
@@ -3687,7 +3687,8 @@ xpm_load (struct frame *f, struct image *img)
 #endif /* HAVE_NTGUI */
 
       /* Remember allocated colors.  */
-      img->colors = xnmalloc (attrs.nalloc_pixels, sizeof *img->colors);
+      img->colors = xnmalloc_atomic (attrs.nalloc_pixels,
+                                     sizeof *img->colors);
       img->ncolors = attrs.nalloc_pixels;
       for (i = 0; i < attrs.nalloc_pixels; ++i)
        {
@@ -4482,7 +4483,7 @@ colors_in_color_table (int *n)
     }
   else
     {
-      colors = xmalloc (ct_colors_allocated * sizeof *colors);
+      colors = xmalloc_atomic (ct_colors_allocated * sizeof *colors);
       *n = ct_colors_allocated;
 
       for (i = j = 0; i < CT_SIZE; ++i)
@@ -5911,8 +5912,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
   if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *rows < height
       || min (PTRDIFF_MAX, SIZE_MAX) / sizeof *pixels / height < row_bytes)
     memory_full (SIZE_MAX);
-  c->pixels = pixels = xmalloc (sizeof *pixels * row_bytes * height);
-  c->rows = rows = xmalloc (height * sizeof *rows);
+  c->pixels = pixels = xmalloc_atomic (sizeof *pixels * row_bytes * height);
+  c->rows = rows = xmalloc_atomic (height * sizeof *rows);
   for (i = 0; i < height; ++i)
     rows[i] = pixels + i * row_bytes;
 
@@ -7013,7 +7014,7 @@ tiff_load (struct frame *f, struct image *img)
       return 0;
     }
 
-  buf = xmalloc (sizeof *buf * width * height);
+  buf = xmalloc_atomic (sizeof *buf * width * height);
 
   rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0);
 
index cc578c5..1deca7e 100644 (file)
@@ -8251,7 +8251,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
       const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : "";
       ptrdiff_t max_lbl =
        2 * max (0, min (tool_bar_max_label_size, STRING_BYTES_BOUND / 2));
-      char *buf = xmalloc (max_lbl + 1);
+      char *buf = xmalloc_atomic (max_lbl + 1);
       Lisp_Object new_lbl;
       ptrdiff_t caption_len = strlen (capt);
 
index ed844a7..5cf5553 100644 (file)
@@ -2778,7 +2778,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
 
              if (saved_doc_string_size == 0)
                {
-                 saved_doc_string = xmalloc (nskip + extra);
+                 saved_doc_string = xmalloc_atomic (nskip + extra);
                  saved_doc_string_size = nskip + extra;
                }
              if (nskip > saved_doc_string_size)
@@ -4079,7 +4079,7 @@ init_obarray (void)
 
   DEFSYM (Qvariable_documentation, "variable-documentation");
 
-  read_buffer = xmalloc (size);
+  read_buffer = xmalloc_atomic (size);
   read_buffer_size = size;
 }
 \f
index 3042b13..6f7a103 100644 (file)
@@ -231,7 +231,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
   val = Qnil;
   size = 100;
   len = 0;
-  line = xmalloc (size);
+  line = xmalloc_atomic (size);
 
   while ((c = getchar ()) != '\n')
     {
index 66976cf..885394c 100644 (file)
@@ -153,7 +153,7 @@ bool print_output_debug_flag EXTERNALLY_VISIBLE = 1;
        else                                                            \
         {                                                              \
           int new_size = 1000;                                         \
-          print_buffer = xmalloc (new_size);                           \
+          print_buffer = xmalloc_atomic (new_size);                    \
           print_buffer_size = new_size;                                \
           free_print_buffer = 1;                                       \
         }                                                              \
index ecfb235..55afb84 100644 (file)
@@ -2578,7 +2578,7 @@ since only regular expressions have distinguished subexpressions.  */)
       substed_alloc_size = (length <= (STRING_BYTES_BOUND - 100) / 2
                            ? length * 2 + 100
                            : STRING_BYTES_BOUND);
-      substed = xmalloc (substed_alloc_size);
+      substed = xmalloc_atomic (substed_alloc_size);
       substed_len = 0;
 
       /* Go thru NEWTEXT, producing the actual text to insert in
@@ -3288,7 +3288,7 @@ syms_of_search (void)
   for (i = 0; i < REGEXP_CACHE_SIZE; ++i)
     {
       searchbufs[i].buf.allocated = 100;
-      searchbufs[i].buf.buffer = xmalloc (100);
+      searchbufs[i].buf.buffer = xmalloc_atomic (100);
       searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
       searchbufs[i].regexp = Qnil;
       searchbufs[i].whitespace_regexp = Qnil;
index 8c766bd..702d30b 100644 (file)
@@ -150,7 +150,7 @@ tgetst1 (char *ptr, char **area)
       p = ptr;
       while ((c = *p++) && c != ':' && c != '\n')
        ;
-      ret = xmalloc (p - ptr + 1);
+      ret = xmalloc_atomic (p - ptr + 1);
     }
   else
     ret = *area;
@@ -374,7 +374,7 @@ tgetent (char *bp, const char *name)
       if (!bp)
        {
          malloc_size = 1 + strlen (term);
-         bp = xmalloc (malloc_size);
+         bp = xmalloc_atomic (malloc_size);
        }
       strcpy (bp, term);
       goto ret;
@@ -433,13 +433,13 @@ tgetent (char *bp, const char *name)
 
   buf.size = BUFSIZE;
   /* Add 1 to size to ensure room for terminating null.  */
-  buf.beg = xmalloc (buf.size + 1);
+  buf.beg = xmalloc_atomic (buf.size + 1);
   term = indirect ? indirect : (char *)name;
 
   if (!bp)
     {
       malloc_size = indirect ? strlen (tcenv) + 1 : buf.size;
-      bp = xmalloc (malloc_size);
+      bp = xmalloc_atomic (malloc_size);
     }
   tc_search_point = bp1 = bp;
 
index e02cea3..2c72db3 100644 (file)
@@ -96,7 +96,7 @@ tparam1 (const char *string, char *outstring, int len,
          if (outlen == 0)
            {
              outlen = len + 40;
-             new = xmalloc (outlen);
+             new = xmalloc_atomic (outlen);
              memcpy (new, outstring, offset);
            }
          else
index 5ac3c50..76ffdb4 100644 (file)
@@ -30641,7 +30641,7 @@ init_xdisp (void)
     /* Allocate the buffer for frame titles.
        Also used for `format-mode-line'.  */
     int size = 100;
-    mode_line_noprop_buf = xmalloc (size);
+    mode_line_noprop_buf = xmalloc_atomic (size);
     mode_line_noprop_buf_end = mode_line_noprop_buf + size;
     mode_line_noprop_ptr = mode_line_noprop_buf;
     mode_line_target = MODE_LINE_DISPLAY;
index 651d212..e8e3fbe 100644 (file)
@@ -1283,7 +1283,7 @@ x_encode_text (Lisp_Object string, Lisp_Object coding_system, int selectionp,
   coding.mode |= (CODING_MODE_SAFE_ENCODING | CODING_MODE_LAST_BLOCK);
   /* We suppress producing escape sequences for composition.  */
   coding.common_flags &= ~CODING_ANNOTATION_MASK;
-  coding.destination = xnmalloc (SCHARS (string), 2);
+  coding.destination = xnmalloc_atomic (SCHARS (string), 2);
   coding.dst_bytes = SCHARS (string) * 2;
   encode_coding_object (&coding, string, 0, 0,
                        SCHARS (string), SBYTES (string), Qnil);
@@ -1681,7 +1681,7 @@ xic_create_fontsetname (const char *base_fontname, int motif)
   if (xic_default_fontset == base_fontname)
     {
       /* There is no base font name, use the default.  */
-      fontsetname = xmalloc (strlen (base_fontname) + 2);
+      fontsetname = xmalloc_atomic (strlen (base_fontname) + 2);
       strcpy (fontsetname, base_fontname);
     }
   else
@@ -1701,8 +1701,8 @@ xic_create_fontsetname (const char *base_fontname, int motif)
          /* As the font name doesn't conform to XLFD, we can't
             modify it to generalize it to allcs and allfamilies.
             Use the specified font plus the default.  */
-         fontsetname = xmalloc (strlen (base_fontname)
-                                + strlen (xic_default_fontset) + 3);
+         fontsetname = xmalloc_atomic (strlen (base_fontname)
+                                        + strlen (xic_default_fontset) + 3);
          strcpy (fontsetname, base_fontname);
          strcat (fontsetname, sep);
          strcat (fontsetname, xic_default_fontset);
@@ -1774,7 +1774,7 @@ xic_create_fontsetname (const char *base_fontname, int motif)
          /* Build the actual font set name.  */
          len = strlen (base_fontname) + strlen (font_allcs)
            + strlen (font_allfamilies) + strlen (font_all) + 5;
-         fontsetname = xmalloc (len);
+         fontsetname = xmalloc_atomic (len);
          strcpy (fontsetname, base_fontname);
          strcat (fontsetname, sep);
          strcat (fontsetname, font_allcs);
@@ -4525,7 +4525,7 @@ FRAME.  Default is to change on the edit X window.  */)
         This applies even if long is more than 32 bits.  The X library
         converts to 32 bits before sending to the X server.  */
       elsize = element_format == 32 ? sizeof (long) : element_format >> 3;
-      data = xnmalloc (nelements, elsize);
+      data = xnmalloc_atomic (nelements, elsize);
 
       x_fill_property_data (FRAME_X_DISPLAY (f), value, data, element_format);
     }
index 107a8fc..589856d 100644 (file)
@@ -111,7 +111,7 @@ magic_db (const char *string, ptrdiff_t string_len, const char *class,
   char *lang = getenv ("LANG");
 
   ptrdiff_t path_size = 100;
-  char *path = xmalloc (path_size);
+  char *path = xmalloc_atomic (path_size);
   ptrdiff_t path_len = 0;
 
   const char *p = string;
@@ -232,7 +232,7 @@ gethomedir (void)
   if (ptr == NULL)
     return xstrdup ("/");
 
-  copy = xmalloc (strlen (ptr) + 2);
+  copy = xmalloc_atomic (strlen (ptr) + 2);
   strcpy (copy, ptr);
   return strcat (copy, "/");
 }
@@ -355,7 +355,7 @@ get_user_db (Display *display)
       char *xdefault;
 
       home = gethomedir ();
-      xdefault = xmalloc (strlen (home) + sizeof ".Xdefaults");
+      xdefault = xmalloc_atomic (strlen (home) + sizeof (".Xdefaults"));
       strcpy (xdefault, home);
       strcat (xdefault, ".Xdefaults");
       db = XrmGetFileDatabase (xdefault);
index 93de0f5..1ed552f 100644 (file)
@@ -1299,7 +1299,7 @@ x_get_window_property (Display *display, Window window, Atom property,
   if (total_size_max < bytes_remaining)
     goto size_overflow;
   total_size = bytes_remaining;
-  data = xmalloc (total_size + 1);
+  data = xmalloc_atomic (total_size + 1);
 
   /* Now read, until we've gotten it all.  */
   while (bytes_remaining)
@@ -1400,7 +1400,7 @@ receive_incremental_selection (Display *display, Window window, Atom property,
   struct prop_location *wait_object;
   if (min (PTRDIFF_MAX, SIZE_MAX) < min_size_bytes)
     memory_full (SIZE_MAX);
-  *data_ret = xmalloc (min_size_bytes);
+  *data_ret = xmalloc_atomic (min_size_bytes);
   *size_bytes_ret = min_size_bytes;
 
   TRACE1 ("Read %u bytes incrementally", min_size_bytes);
index 650cfae..645e199 100644 (file)
@@ -229,7 +229,7 @@ smc_save_yourself_CB (SmcConn smcConn,
   props[props_idx]->vals[vp_idx].length = strlen (emacs_program);
   props[props_idx]->vals[vp_idx++].value = emacs_program;
 
-  smid_opt = xmalloc (strlen (SMID_OPT) + strlen (client_id) + 1);
+  smid_opt = xmalloc_atomic (strlen (SMID_OPT) + strlen (client_id) + 1);
   strcpy (smid_opt, SMID_OPT);
   strcat (smid_opt, client_id);
 
@@ -241,7 +241,7 @@ smc_save_yourself_CB (SmcConn smcConn,
 
   if (cwd)
     {
-      chdir_opt = xmalloc (strlen (CHDIR_OPT) + strlen (cwd) + 1);
+      chdir_opt = xmalloc_atomic (strlen (CHDIR_OPT) + strlen (cwd) + 1);
       strcpy (chdir_opt, CHDIR_OPT);
       strcat (chdir_opt, cwd);
 
@@ -414,7 +414,7 @@ x_session_initialize (struct x_display_info *dpyinfo)
 
   /* This malloc will not be freed, but it is only done once, and hopefully
      not very large   */
-  emacs_program = xmalloc (name_len + 1);
+  emacs_program = xmalloc_atomic (name_len + 1);
   emacs_program[0] = '\0';
 
   if (! EQ (Vinvocation_directory, Qnil))
index 45bb7b2..eb33259 100644 (file)
@@ -10016,8 +10016,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
   if (lim - SBYTES (Vinvocation_name) < SBYTES (Vsystem_name))
     memory_full (SIZE_MAX);
   dpyinfo->x_id = ++x_display_id;
-  dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name)
-                               + SBYTES (Vsystem_name) + 2);
+  dpyinfo->x_id_name = xmalloc_atomic (SBYTES (Vinvocation_name)
+                                       + SBYTES (Vsystem_name) + 2);
   strcat (strcat (strcpy (dpyinfo->x_id_name, SSDATA (Vinvocation_name)), "@"),
          SSDATA (Vsystem_name));