summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-05-15 21:57:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-05-15 21:57:32 -0700
commitf02bad80e9ca6af0abd2d58d5ebaf6c3f83d9bae (patch)
tree593cb9e22fecb325c5edfaaa083b60f6b62b60ad
parent02612f7d0181580f7558157283ea9a724f19fc64 (diff)
downloadtxr-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.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/ffi.c b/ffi.c
index aebd8234..fe55e642 100644
--- a/ffi.c
+++ b/ffi.c
@@ -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);
}
}