emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108765: * alloc.c (allocate_string):


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108765: * alloc.c (allocate_string): Remove two redundant calls
Date: Wed, 27 Jun 2012 15:19:54 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108765
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2012-06-27 15:19:54 +0400
message:
  * alloc.c (allocate_string):  Remove two redundant calls
  to memset, add explicit initialization where appropriate.
modified:
  src/ChangeLog
  src/alloc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-06-27 07:47:56 +0000
+++ b/src/ChangeLog     2012-06-27 11:19:54 +0000
@@ -1,3 +1,8 @@
+2012-06-27  Dmitry Antipov  <address@hidden>
+
+       * alloc.c (allocate_string):  Remove two redundant calls
+       to memset, add explicit initialization where appropriate.
+
 2012-06-27  Glenn Morris  <address@hidden>
 
        * lisp.mk (lisp): Remove paths.elc.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-06-27 03:49:35 +0000
+++ b/src/alloc.c       2012-06-27 11:19:54 +0000
@@ -1936,13 +1936,14 @@
       int i;
 
       b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING);
-      memset (b, 0, sizeof *b);
       b->next = string_blocks;
       string_blocks = b;
 
       for (i = STRING_BLOCK_SIZE - 1; i >= 0; --i)
        {
          s = b->strings + i;
+         /* Every string on a free list should have NULL data pointer.  */
+         s->data = NULL;
          NEXT_FREE_LISP_STRING (s) = string_free_list;
          string_free_list = s;
        }
@@ -1958,8 +1959,10 @@
 
   MALLOC_UNBLOCK_INPUT;
 
-  /* Probably not strictly necessary, but play it safe.  */
-  memset (s, 0, sizeof *s);
+  /* SIZE and SIZE_BYTE fields will be initialized
+     by calling allocate_string_data.  */
+  s->intervals = NULL_INTERVAL;
+  s->data = NULL;
 
   --total_free_strings;
   ++total_strings;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]