diff options
author | Andy Wingo <wingo@pobox.com> | 2013-08-31 10:57:11 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2013-08-31 10:57:11 +0200 |
commit | 25752c4d1cef1049578d6b9b2cd0b6e44b8b8de7 (patch) | |
tree | c32a3d8349b374308cde8d8e4eb4bd70a33ecd06 | |
parent | be7ecef05c1eea66f30360f658c610710c5cb22e (diff) | |
download | guile-25752c4d1cef1049578d6b9b2cd0b6e44b8b8de7.tar.gz |
Faster scm_from_port_stringn
* libguile/strings.c (scm_from_port_stringn): Always inline to
scm_from_utf8_string if the byte sequence is valid utf-8.
-rw-r--r-- | libguile/strings.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libguile/strings.c b/libguile/strings.c index fa97a0057..8ee909bca 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -1740,7 +1740,8 @@ scm_from_port_stringn (const char *str, size_t len, SCM port) if (pti->encoding_mode == SCM_PORT_ENCODING_MODE_LATIN1) return scm_from_latin1_stringn (str, len); else if (pti->encoding_mode == SCM_PORT_ENCODING_MODE_UTF8 - && pt->ilseq_handler == SCM_FAILED_CONVERSION_ERROR) + && (pt->ilseq_handler == SCM_FAILED_CONVERSION_ERROR + || (u8_check ((uint8_t *) str, len) == NULL))) return scm_from_utf8_stringn (str, len); else return scm_from_stringn (str, len, pt->encoding, pt->ilseq_handler); |