diff options
author | Andy Wingo <wingo@pobox.com> | 2012-02-14 09:35:22 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2012-02-14 14:24:32 +0100 |
commit | 098818a165bea6cbfee8f56a833bc2e48e4f30b0 (patch) | |
tree | c9bcdf62602dcfd4dda75f99e201972752aa1ed3 | |
parent | 33aadcab8a975753d757924f4eb59fe1223dfbd2 (diff) | |
download | guile-098818a165bea6cbfee8f56a833bc2e48e4f30b0.tar.gz |
scm_from_stringn utf8 optimization
* libguile/strings.c (scm_from_stringn): Optimize scm_from_stringn for
utf-8.
-rw-r--r-- | libguile/strings.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libguile/strings.c b/libguile/strings.c index 8c404a372..961705782 100644 --- 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, |