emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master a597969 3/3: allocate_vectorlike minor cleanup


From: Paul Eggert
Subject: [Emacs-diffs] master a597969 3/3: allocate_vectorlike minor cleanup
Date: Sun, 3 Dec 2017 21:18:09 -0500 (EST)

branch: master
commit a597969f1360b8c28fd4467018792662b698e03a
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    allocate_vectorlike minor cleanup
    
    * src/alloc.c (allocate_vectorlike): Move a bit of code out of the
    critical section.  Although this doesn’t really help performance,
    it cleans up the code a bit and should make it easier to add
    pointer bounds checking.
---
 src/alloc.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index 49c9950..4f3928a 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3317,15 +3317,14 @@ sweep_vectors (void)
 static struct Lisp_Vector *
 allocate_vectorlike (ptrdiff_t len)
 {
-  struct Lisp_Vector *p;
-
-  MALLOC_BLOCK_INPUT;
-
   if (len == 0)
-    p = XVECTOR (zero_vector);
+    return XVECTOR (zero_vector);
   else
     {
       size_t nbytes = header_size + len * word_size;
+      struct Lisp_Vector *p;
+
+      MALLOC_BLOCK_INPUT;
 
 #ifdef DOUG_LEA_MALLOC
       if (!mmap_lisp_allowed_p ())
@@ -3355,11 +3354,11 @@ allocate_vectorlike (ptrdiff_t len)
 
       consing_since_gc += nbytes;
       vector_cells_consed += len;
-    }
 
-  MALLOC_UNBLOCK_INPUT;
+      MALLOC_UNBLOCK_INPUT;
 
-  return p;
+      return p;
+    }
 }
 
 



reply via email to

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