From 163e83009d82200f5bcb8183f72bebe911851245 Mon Sep 17 00:00:00 2001 From: "Enrico Fraccaroli (Galfurian)" Date: Wed, 30 Aug 2023 15:38:52 -0400 Subject: [PATCH] Make tokenize work with a const char pointer. --- libc/inc/string.h | 2 +- libc/src/string.c | 2 +- mentos/src/klib/string.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/inc/string.h b/libc/inc/string.h index 6f976f8..058fbb8 100644 --- a/libc/inc/string.h +++ b/libc/inc/string.h @@ -177,7 +177,7 @@ char *strtok_r(char *str, const char *delim, char **saveptr); /// @param buffer the buffer where we save the parsed token. /// @param buflen the length of the buffer. /// @return 1 if we still have things to parse, 0 if we finished parsing. -int tokenize(char *string, char *separators, size_t *offset, char *buffer, ssize_t buflen); +int tokenize(const char *string, char *separators, size_t *offset, char *buffer, ssize_t buflen); /// @brief Copies the values of num bytes from the location pointed by source /// to the memory block pointed by destination. diff --git a/libc/src/string.c b/libc/src/string.c index ab4f28c..b5c1367 100644 --- a/libc/src/string.c +++ b/libc/src/string.c @@ -218,7 +218,7 @@ char *strpbrk(const char *string, const char *control) return NULL; } -int tokenize(char *string, char *separators, size_t *offset, char *buffer, ssize_t buflen) +int tokenize(const char *string, char *separators, size_t *offset, char *buffer, ssize_t buflen) { // If we reached the end of the parsed string, stop. if (string[*offset] == 0) { diff --git a/mentos/src/klib/string.c b/mentos/src/klib/string.c index ab4f28c..b5c1367 100644 --- a/mentos/src/klib/string.c +++ b/mentos/src/klib/string.c @@ -218,7 +218,7 @@ char *strpbrk(const char *string, const char *control) return NULL; } -int tokenize(char *string, char *separators, size_t *offset, char *buffer, ssize_t buflen) +int tokenize(const char *string, char *separators, size_t *offset, char *buffer, ssize_t buflen) { // If we reached the end of the parsed string, stop. if (string[*offset] == 0) {