guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-140-g69cd5


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-140-g69cd529
Date: Tue, 10 Jan 2012 15:28:22 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=69cd5299e308571149d15eac774ee23fc97ecb0e

The branch, stable-2.0 has been updated
       via  69cd5299e308571149d15eac774ee23fc97ecb0e (commit)
      from  17bec5451bfb14c1412669a40b78e483dfe56933 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 69cd5299e308571149d15eac774ee23fc97ecb0e
Author: Mark H Weaver <address@hidden>
Date:   Tue Jan 10 10:13:43 2012 -0500

    Use a common null stringbuf in `scm_i_make_string'
    
    * libguile/strings.c (scm_i_make_string): Use a common null stringbuf
      for newly-allocated empty strings.

-----------------------------------------------------------------------

Summary of changes:
 libguile/strings.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/libguile/strings.c b/libguile/strings.c
index 5dcb321..8491b1e 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -267,8 +267,22 @@ SCM scm_nullstr;
 SCM
 scm_i_make_string (size_t len, char **charsp, int read_only_p)
 {
-  SCM buf = make_stringbuf (len);
+  static SCM null_stringbuf = SCM_BOOL_F;
+  SCM buf;
   SCM res;
+
+  if (len == 0)
+    {
+      if (SCM_UNLIKELY (scm_is_false (null_stringbuf)))
+        {
+          null_stringbuf = make_stringbuf (0);
+          SET_STRINGBUF_SHARED (null_stringbuf);
+        }
+      buf = null_stringbuf;
+    }
+  else
+    buf = make_stringbuf (len);
+
   if (charsp)
     *charsp = (char *) STRINGBUF_CHARS (buf);
   res = scm_double_cell (read_only_p ? RO_STRING_TAG : STRING_TAG,


hooks/post-receive
-- 
GNU Guile



reply via email to

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