changeset 23773:f11f551fee99

(Fstring_as_unibyte, Fstring_as_multibyte): Clear text properties in the new string.
author Richard M. Stallman <rms@gnu.org>
date Fri, 27 Nov 1998 22:15:38 +0000
parents afe440aabd55
children 43fd01db076b
files src/fns.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Thu Nov 26 08:37:32 1998 +0000
+++ b/src/fns.c	Fri Nov 27 22:15:38 1998 +0000
@@ -1002,7 +1002,9 @@
 DEFUN ("string-as-unibyte", Fstring_as_unibyte, Sstring_as_unibyte,
        1, 1, 0,
   "Return a unibyte string with the same individual bytes as STRING.\n\
-If STRING is unibyte, the result is STRING itself.")
+If STRING is unibyte, the result is STRING itself.\n\
+If STRING is multibyte, the result is STRING itself.\n\
+Otherwise it is a newly created string, with no text properties.")
   (string)
      Lisp_Object string;
 {
@@ -1012,6 +1014,7 @@
     {
       string = Fcopy_sequence (string);
       XSTRING (string)->size = STRING_BYTES (XSTRING (string));
+      XSTRING (string)->intervals = NULL_INTERVAL;
       SET_STRING_BYTES (XSTRING (string), -1);
     }
   return string;
@@ -1020,7 +1023,8 @@
 DEFUN ("string-as-multibyte", Fstring_as_multibyte, Sstring_as_multibyte,
        1, 1, 0,
   "Return a multibyte string with the same individual bytes as STRING.\n\
-If STRING is multibyte, the result is STRING itself.")
+If STRING is multibyte, the result is STRING itself.\n\
+Otherwise it is a newly created string, with no text properties.")
   (string)
      Lisp_Object string;
 {
@@ -1034,6 +1038,7 @@
       string = Fcopy_sequence (string);
       XSTRING (string)->size = newlen;
       XSTRING (string)->size_byte = nbytes;
+      XSTRING (string)->intervals = NULL_INTERVAL;
     }
   return string;
 }