aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1998-06-29 17:20:52 +0000
committerRichard M. Stallman <[email protected]>1998-06-29 17:20:52 +0000
commit8a2df9371a8d2c15009b943d5ec020ebbfea0ec2 (patch)
tree8b10056ef3b136ff368817a9a5c07b7d26398a70 /src
parent09ffb8b54395974807c8475391f478d3f950a720 (diff)
(wordify): Fix i_byte even in unibyte case for copy loop.
If input is unibyte, make the output unibyte.
Diffstat (limited to 'src')
-rw-r--r--src/search.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/search.c b/src/search.c
index d706854743..29a6fe4ff4 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)
{