From: Richard M. Stallman Date: Mon, 29 Jun 1998 17:20:52 +0000 (+0000) Subject: (wordify): Fix i_byte even in unibyte case for copy loop. X-Git-Tag: emacs-20.3~439 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8a2df9371a8d2c15009b943d5ec020ebbfea0ec2;p=emacs.git (wordify): Fix i_byte even in unibyte case for copy loop. If input is unibyte, make the output unibyte. --- diff --git a/src/search.c b/src/search.c index d7068547434..29a6fe4ff4f 100644 --- a/src/search.c +++ b/src/search.c @@ -1983,8 +1983,12 @@ wordify (string) 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 @@ wordify (string) 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) {