aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-06-29 17:20:52 +0000
committerRichard M. Stallman1998-06-29 17:20:52 +0000
commit8a2df9371a8d2c15009b943d5ec020ebbfea0ec2 (patch)
tree8b10056ef3b136ff368817a9a5c07b7d26398a70 /src
parent09ffb8b54395974807c8475391f478d3f950a720 (diff)
downloademacs-8a2df9371a8d2c15009b943d5ec020ebbfea0ec2.tar.gz
emacs-8a2df9371a8d2c15009b943d5ec020ebbfea0ec2.zip
(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 d7068547434..29a6fe4ff4f 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1983,8 +1983,12 @@ wordify (string)
1983 return build_string (""); 1983 return build_string ("");
1984 1984
1985 adjust = - punct_count + 5 * (word_count - 1) + 4; 1985 adjust = - punct_count + 5 * (word_count - 1) + 4;
1986 val = make_uninit_multibyte_string (len + adjust, 1986 if (STRING_MULTIBYTE (string))
1987 STRING_BYTES (XSTRING (string)) + adjust); 1987 val = make_uninit_multibyte_string (len + adjust,
1988 STRING_BYTES (XSTRING (string))
1989 + adjust);
1990 else
1991 val = make_uninit_string (len + adjust);
1988 1992
1989 o = XSTRING (val)->data; 1993 o = XSTRING (val)->data;
1990 *o++ = '\\'; 1994 *o++ = '\\';
@@ -1999,7 +2003,10 @@ wordify (string)
1999 if (STRING_MULTIBYTE (string)) 2003 if (STRING_MULTIBYTE (string))
2000 FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte); 2004 FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte);
2001 else 2005 else
2002 c = XSTRING (string)->data[i++]; 2006 {
2007 c = XSTRING (string)->data[i++];
2008 i_byte++;
2009 }
2003 2010
2004 if (SYNTAX (c) == Sword) 2011 if (SYNTAX (c) == Sword)
2005 { 2012 {