HCoop
/
bpt
/
guile.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
33aadca
)
scm_from_stringn utf8 optimization
author
Andy Wingo
<wingo@pobox.com>
Tue, 14 Feb 2012 08:35:22 +0000
(09:35 +0100)
committer
Andy Wingo
<wingo@pobox.com>
Tue, 14 Feb 2012 13:24:32 +0000
(14:24 +0100)
* libguile/strings.c (scm_from_stringn): Optimize scm_from_stringn for
utf-8.
libguile/strings.c
patch
|
blob
|
blame
|
history
diff --git
a/libguile/strings.c
b/libguile/strings.c
index
8c404a3
..
9617057
100644
(file)
--- a/
libguile/strings.c
+++ b/
libguile/strings.c
@@
-1525,13
+1525,9
@@
scm_from_stringn (const char *str, size_t len, const char *encoding,
len = strlen (str);
if (encoding == NULL || len == 0)
- {
- /* If encoding is null (or the string is empty), use Latin-1. */
- char *buf;
- res = scm_i_make_string (len, &buf, 0);
- memcpy (buf, str, len);
- return res;
- }
+ return scm_from_latin1_stringn (str, len);
+ else if (strcmp (encoding, "UTF-8") == 0)
+ return scm_from_utf8_stringn (str, len);
u32len = 0;
u32 = (scm_t_wchar *) u32_conv_from_encoding (encoding,