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-138-gd6a56


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-138-gd6a569c
Date: Tue, 10 Jan 2012 12:54: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=d6a569c191e14ed756135cff3de35371b1b8757b

The branch, stable-2.0 has been updated
       via  d6a569c191e14ed756135cff3de35371b1b8757b (commit)
      from  7532125912a381c0770aa7af596b7401942c685b (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 d6a569c191e14ed756135cff3de35371b1b8757b
Author: Mark H Weaver <address@hidden>
Date:   Tue Jan 10 07:50:28 2012 -0500

    scm_i_substring_copy tries to narrow the substring
    
    * libguile/strings.c (scm_i_substring_copy): Try to narrow the substring
      if it came from a wide string.

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

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

diff --git a/libguile/strings.c b/libguile/strings.c
index c94a200..2aa226d 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -349,8 +349,9 @@ SCM
 scm_i_substring_copy (SCM str, size_t start, size_t end)
 {
   size_t len = end - start;
-  SCM buf, my_buf;
+  SCM buf, my_buf, substr;
   size_t str_start;
+  int wide = 0;
   get_str_buf_start (&str, &buf, &str_start);
   if (scm_i_is_narrow_string (str))
     {
@@ -364,12 +365,14 @@ scm_i_substring_copy (SCM str, size_t start, size_t end)
       u32_cpy ((scm_t_uint32 *) STRINGBUF_WIDE_CHARS (my_buf),
                (scm_t_uint32 *) (STRINGBUF_WIDE_CHARS (buf) + str_start 
                                  + start), len);
-      /* Even though this string is wide, the substring may be narrow.
-         Consider adding code to narrow the string.  */
+      wide = 1;
     }
   scm_remember_upto_here_1 (buf);
-  return scm_double_cell (STRING_TAG, SCM_UNPACK (my_buf),
-                          (scm_t_bits) 0, (scm_t_bits) len);
+  substr = scm_double_cell (STRING_TAG, SCM_UNPACK (my_buf),
+                            (scm_t_bits) 0, (scm_t_bits) len);
+  if (wide)
+    scm_i_try_narrow_string (substr);
+  return substr;
 }
 
 SCM


hooks/post-receive
-- 
GNU Guile



reply via email to

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