1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

scm_mkstrport: Optimize the POS -> BYTE_POS conversion.

* libguile/strports.c (scm_mkstrport): Use 'scm_c_string_utf8_length' to
avoid the conversion to UTF-8.
This commit is contained in:
Mark H Weaver 2019-06-18 02:09:16 -04:00
parent 8150823fc8
commit 9f7a824206

View file

@ -195,8 +195,8 @@ scm_mkstrport (SCM pos, SCM str, long modes, const char *caller)
else
/* Inefficient but simple way to convert the character position
POS into a byte position BYTE_POS. */
free (scm_to_utf8_stringn (scm_substring (str, SCM_INUM0, pos),
&byte_pos));
byte_pos = scm_c_string_utf8_length
(scm_substring (str, SCM_INUM0, pos));
}
stream = scm_gc_typed_calloc (struct string_port);