Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
5b6dddaa
Commit
5b6dddaa
authored
Jun 18, 1997
by
Kenichi Handa
Browse files
(concat): Pay attention to multibyte characters when
TARGET_TYPE is Lisp_String.
parent
765a2ca5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
src/fns.c
src/fns.c
+25
-4
No files found.
src/fns.c
View file @
5b6dddaa
...
...
@@ -406,7 +406,23 @@ concat (nargs, args, target_type, last_special)
{
this
=
args
[
argnum
];
len
=
Flength
(
this
);
leni
+=
XFASTINT
(
len
);
if
(
VECTORP
(
this
)
&&
target_type
==
Lisp_String
)
{
/* We must pay attention to a multibyte character which
takes more than one byte in string. */
int
i
;
Lisp_Object
ch
;
for
(
i
=
0
;
i
<
XFASTINT
(
len
);
i
++
)
{
ch
=
XVECTOR
(
this
)
->
contents
[
i
];
if
(
!
INTEGERP
(
ch
))
wrong_type_argument
(
Qintegerp
,
ch
);
leni
+=
Fchar_bytes
(
ch
);
}
}
else
leni
+=
XFASTINT
(
len
);
}
XSETFASTINT
(
len
,
leni
);
...
...
@@ -490,14 +506,19 @@ concat (nargs, args, target_type, last_special)
while
(
!
INTEGERP
(
elt
))
elt
=
wrong_type_argument
(
Qintegerp
,
elt
);
{
int
c
=
XINT
(
elt
);
unsigned
char
work
[
4
],
*
str
;
int
i
=
CHAR_STRING
(
c
,
work
,
str
);
#ifdef MASSC_REGISTER_BUG
/* Even removing all "register"s doesn't disable this bug!
Nothing simpler than this seems to work. */
unsigned
char
*
p
=
&
XSTRING
(
val
)
->
data
[
toindex
++
];
*
p
=
XINT
(
elt
);
unsigned
char
*
p
=
&
XSTRING
(
val
)
->
data
[
toindex
];
bcopy
(
str
,
p
,
i
);
#else
XSTRING
(
val
)
->
data
[
toindex
++
]
=
XINT
(
elt
);
bcopy
(
str
,
&
XSTRING
(
val
)
->
data
[
toindex
],
i
);
#endif
toindex
+=
i
;
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment