diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-05-15 21:57:32 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-05-15 21:57:32 -0700 |
commit | f02bad80e9ca6af0abd2d58d5ebaf6c3f83d9bae (patch) | |
tree | 593cb9e22fecb325c5edfaaa083b60f6b62b60ad | |
parent | 02612f7d0181580f7558157283ea9a724f19fc64 (diff) | |
download | txr-f02bad80e9ca6af0abd2d58d5ebaf6c3f83d9bae.tar.gz txr-f02bad80e9ca6af0abd2d58d5ebaf6c3f83d9bae.tar.bz2 txr-f02bad80e9ca6af0abd2d58d5ebaf6c3f83d9bae.zip |
ffi: take advantage of string_utf8_from_buf.
* ffi.c (ffi_char_array_get, ffi_zchar_array_get):
Use newly added string_utf8_from_buf rather than
utf8_dup_from_buf followed by string_own.
-rw-r--r-- | ffi.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -2870,8 +2870,7 @@ static val ffi_char_array_get(struct txr_ffi_type *tft, mem_t *src, } else if (nelem == 0) { return null_string; } else { - wchar_t *wch = utf8_dup_from_buf(chptr, nelem); - return string_own(wch); + return string_utf8_from_buf(chptr, nelem); } } @@ -2906,8 +2905,7 @@ static val ffi_zchar_array_get(struct txr_ffi_type *tft, mem_t *src, } else if (memchr(chptr, 0, nelem)) { return string_utf8(chptr); } else { - wchar_t *wch = utf8_dup_from_buf(chptr, nelem); - return string_own(wch); + return string_utf8_from_buf(chptr, nelem); } } |