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.6-13-gb90876


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.6-13-gb908768
Date: Mon, 20 Aug 2012 21:39:06 +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=b908768a7ec79f78def344c464186a51f55b69e8

The branch, stable-2.0 has been updated
       via  b908768a7ec79f78def344c464186a51f55b69e8 (commit)
      from  ee26a9ebe2d93263473db7d68e74a317eaf053ac (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 b908768a7ec79f78def344c464186a51f55b69e8
Author: Ludovic Courtès <address@hidden>
Date:   Mon Aug 20 23:38:21 2012 +0200

    Optimize `scm_lfwrite_substr', used by `scm_simple_format'.
    
    Fixes <http://bugs.gnu.org/12033>.
    Reported by nalaginrut <address@hidden>.
    
    * libguile/print.c (scm_i_display_substring): New function.
    * libguile/print.h (scm_i_display_substring): New internal declaration.
    * libguile/ports.c (scm_lfwrite_substr): Use it instead of `scm_display'
      + `scm_c_substring'.

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

Summary of changes:
 libguile/ports.c |    2 +-
 libguile/print.c |   23 +++++++++++++++++++++++
 libguile/print.h |    5 ++++-
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/libguile/ports.c b/libguile/ports.c
index 2f8c792..301bc44 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -1465,7 +1465,7 @@ scm_lfwrite_substr (SCM str, size_t start, size_t end, 
SCM port)
   if (end == (size_t) -1)
     end = scm_i_string_length (str);
 
-  scm_display (scm_c_substring (str, start, end), port);
+  scm_i_display_substring (str, start, end, port);
 
   if (pt->rw_random)
     pt->rw_active = SCM_PORT_WRITE;
diff --git a/libguile/print.c b/libguile/print.c
index cb3c0b9..647eed8 100644
--- a/libguile/print.c
+++ b/libguile/print.c
@@ -1167,6 +1167,29 @@ write_character (scm_t_wchar ch, SCM port, int 
string_escapes_p)
     write_character_escaped (ch, string_escapes_p, port);
 }
 
+/* Display STR to PORT from START inclusive to END exclusive.  */
+void
+scm_i_display_substring (SCM str, size_t start, size_t end, SCM port)
+{
+  int narrow_p;
+  const char *buf;
+  size_t len, printed;
+
+  buf = scm_i_string_data (str);
+  len = end - start;
+  narrow_p = scm_i_is_narrow_string (str);
+  buf += start * (narrow_p ? sizeof (char) : sizeof (scm_t_wchar));
+
+  printed = display_string (buf, narrow_p, end - start, port,
+                           PORT_CONVERSION_HANDLER (port));
+
+  if (SCM_UNLIKELY (printed < len))
+    scm_encoding_error (__func__, errno,
+                       "cannot convert to output locale",
+                       port, scm_c_string_ref (str, printed + start));
+}
+
+
 /* Print an integer.
  */
 
diff --git a/libguile/print.h b/libguile/print.h
index 64d1f4b..4c60b52 100644
--- a/libguile/print.h
+++ b/libguile/print.h
@@ -3,7 +3,8 @@
 #ifndef SCM_PRINT_H
 #define SCM_PRINT_H
 
-/* Copyright (C) 1995,1996,1998,2000,2001, 2003, 2004, 2006, 2008, 2010 Free 
Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1998, 2000, 2001, 2003, 2004, 2006, 2008,
+ *   2010, 2012 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -78,6 +79,8 @@ SCM_API SCM scm_print_options (SCM setting);
 SCM_API SCM scm_make_print_state (void);
 SCM_API void scm_free_print_state (SCM print_state);
 SCM_INTERNAL SCM scm_i_port_with_print_state (SCM port, SCM print_state);
+SCM_INTERNAL void scm_i_display_substring (SCM str, size_t start, size_t end,
+                                          SCM port);
 SCM_API void scm_intprint (scm_t_intmax n, int radix, SCM port);
 SCM_API void scm_uintprint (scm_t_uintmax n, int radix, SCM port);
 SCM_API void scm_ipruk (char *hdr, SCM ptr, SCM port);


hooks/post-receive
-- 
GNU Guile



reply via email to

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