changeset 22640:929ad308aba6

(wordify): Fix i_byte even in unibyte case for copy loop. If input is unibyte, make the output unibyte.
author Richard M. Stallman <rms@gnu.org>
date Mon, 29 Jun 1998 17:20:52 +0000
parents 8177901b437a
children 1c5197790616
files src/search.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Mon Jun 29 13:32:48 1998 +0000
+++ b/src/search.c	Mon Jun 29 17:20:52 1998 +0000
@@ -1983,8 +1983,12 @@
     return build_string ("");
 
   adjust = - punct_count + 5 * (word_count - 1) + 4;
-  val = make_uninit_multibyte_string (len + adjust,
-				      STRING_BYTES (XSTRING (string)) + adjust);
+  if (STRING_MULTIBYTE (string))
+    val = make_uninit_multibyte_string (len + adjust,
+					STRING_BYTES (XSTRING (string))
+					+ adjust);
+  else
+    val = make_uninit_string (len + adjust);
 
   o = XSTRING (val)->data;
   *o++ = '\\';
@@ -1999,7 +2003,10 @@
       if (STRING_MULTIBYTE (string))
 	FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte);
       else
-	c = XSTRING (string)->data[i++];
+	{
+	  c = XSTRING (string)->data[i++];
+	  i_byte++;
+	}
 
       if (SYNTAX (c) == Sword)
 	{