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-112-g49d09


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-112-g49d0929
Date: Sat, 07 Jan 2012 15:38:57 +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=49d09292ac6d92a86b574478a69450b85d2dd8c1

The branch, stable-2.0 has been updated
       via  49d09292ac6d92a86b574478a69450b85d2dd8c1 (commit)
      from  a7e392c1fff2921af027675e8655b5892ac1142e (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 49d09292ac6d92a86b574478a69450b85d2dd8c1
Author: Mark H Weaver <address@hidden>
Date:   Wed Jan 4 17:59:27 2012 -0500

    Fix bugs related to mutation-sharing substrings
    
    * libguile/strings.c (scm_i_is_narrow_string, scm_i_try_narrow_string,
      scm_i_string_set_x): Check to see if the provided string is a
      mutation-sharing substring, and do the right thing in that case.
      Previously, if such a string was passed to these functions, they would
      behave very badly: while trying to fetch and/or mutate the cell
      containing the stringbuf, they were actually fetching or mutating the
      cell containing the original shared string.  That's because
      mutation-sharing substrings store the original string in CELL_1,
      whereas all other strings store the stringbuf there.

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

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

diff --git a/libguile/strings.c b/libguile/strings.c
index 870825a..6e1f9c8 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -436,6 +436,9 @@ scm_i_string_length (SCM str)
 int
 scm_i_is_narrow_string (SCM str)
 {
+  if (IS_SH_STRING (str))
+    str = SH_STRING_STRING (str);
+
   return !STRINGBUF_WIDE (STRING_STRINGBUF (str));
 }
 
@@ -446,6 +449,9 @@ scm_i_is_narrow_string (SCM str)
 int
 scm_i_try_narrow_string (SCM str)
 {
+  if (IS_SH_STRING (str))
+    str = SH_STRING_STRING (str);
+
   SET_STRING_STRINGBUF (str, narrow_stringbuf (STRING_STRINGBUF (str)));
 
   return scm_i_is_narrow_string (str);
@@ -664,6 +670,12 @@ scm_i_string_strcmp (SCM sstr, size_t start_x, const char 
*cstr)
 void
 scm_i_string_set_x (SCM str, size_t p, scm_t_wchar chr)
 {
+  if (IS_SH_STRING (str))
+    {
+      p += STRING_START (str);
+      str = SH_STRING_STRING (str);
+    }
+
   if (chr > 0xFF && scm_i_is_narrow_string (str))
     SET_STRING_STRINGBUF (str, wide_stringbuf (STRING_STRINGBUF (str)));
 


hooks/post-receive
-- 
GNU Guile



reply via email to

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