[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/04: scm_mkstrport: Optimize the POS -> BYTE_POS conve
From: |
Mark H. Weaver |
Subject: |
[Guile-commits] 01/04: scm_mkstrport: Optimize the POS -> BYTE_POS conversion. |
Date: |
Tue, 18 Jun 2019 03:25:07 -0400 (EDT) |
mhw pushed a commit to branch stable-2.2
in repository guile.
commit 9f7a824206702350427aa59382082d1019c3011d
Author: Mark H Weaver <address@hidden>
Date: Tue Jun 18 02:09:16 2019 -0400
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.
---
libguile/strports.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libguile/strports.c b/libguile/strports.c
index 876a62a..14cdfa0 100644
--- a/libguile/strports.c
+++ b/libguile/strports.c
@@ -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);