summaryrefslogtreecommitdiff
path: root/src/lib/string.c
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-08-25 20:56:55 +0000
committerpeter <peter@pmikkelsen.com>2026-08-25 20:56:55 +0000
commit86a65e695b9dc1fb7a20094204339f5bf168fb92 (patch)
treec4ab839a70c830097103d33797fedf01261d1800 /src/lib/string.c
parent956cfb9ac26f44d05ffc446f30f84174865685a4 (diff)
Start working on modules, including a built-in "boot" module
FossilOrigin-Name: 4829dbeb2071fe0be41ded66a61ba2e156119a47def8a23415b8227a00d53ce7
Diffstat (limited to 'src/lib/string.c')
-rw-r--r--src/lib/string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/string.c b/src/lib/string.c
index 123e81b..ecac9d7 100644
--- a/src/lib/string.c
+++ b/src/lib/string.c
@@ -1,7 +1,7 @@
#include "aplwc_internal.h"
struct string *
-chars_to_string(struct aplwc *aplwc, const char *chars)
+chars_to_string(struct aplwc *aplwc, const char *chars, int len)
{
const uint8_t *utf8;
size_t bytecount, charcount;
@@ -12,7 +12,7 @@ chars_to_string(struct aplwc *aplwc, const char *chars)
utf8 = (const uint8_t *)chars;
seqlen = extra = 0;
- for(bytecount = 0, charcount = 0; utf8[bytecount]; bytecount++){
+ for(bytecount = 0, charcount = 0; ((bytecount < (unsigned int)len) || (len == -1)) && utf8[bytecount]; bytecount++){
b = utf8[bytecount];
if(extra == 0){
c = 0;