changeset 21235:eba3d61855d0

(make_buffer_string_both): New function. (make_buffer_string): Use make_buffer_string_both.
author Richard M. Stallman <rms@gnu.org>
date Sat, 21 Mar 1998 02:57:08 +0000
parents 39a678194350
children 90e90245e679
files src/editfns.c
diffstat 1 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Fri Mar 20 22:38:54 1998 +0000
+++ b/src/editfns.c	Sat Mar 21 02:57:08 1998 +0000
@@ -1445,10 +1445,34 @@
      int start, end;
      int props;
 {
-  Lisp_Object result, tem, tem1;
   int start_byte = CHAR_TO_BYTE (start);
   int end_byte = CHAR_TO_BYTE (end);
 
+  return make_buffer_string_both (start, start_byte, end, end_byte, props);
+}
+
+/* Return a Lisp_String containing the text of the current buffer from
+   START / START_BYTE to END / END_BYTE.
+
+   If text properties are in use and the current buffer
+   has properties in the range specified, the resulting string will also
+   have them, if PROPS is nonzero.
+
+   We don't want to use plain old make_string here, because it calls
+   make_uninit_string, which can cause the buffer arena to be
+   compacted.  make_string has no way of knowing that the data has
+   been moved, and thus copies the wrong data into the string.  This
+   doesn't effect most of the other users of make_string, so it should
+   be left as is.  But we should use this function when conjuring
+   buffer substrings.  */
+
+Lisp_Object
+make_buffer_string_both (start, start_byte, end, end_byte, props)
+     int start, start_byte, end, end_byte;
+     int props;
+{
+  Lisp_Object result, tem, tem1;
+
   if (start < GPT && GPT < end)
     move_gap (start);