diff options
| author | rajdakin <rajdakin@gmail.com> | 2024-09-07 15:20:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-07 15:20:17 +0200 |
| commit | f0d7582845e124ed61b86f43da30a7b3f3f0c3f5 (patch) | |
| tree | 2ee0c53821805b33ca47e0919fea95ccb920cd52 /wrapperhelper/src/cstring.h | |
| parent | 75bdb328284b8e5b6827eeb7d5cedef26222e7db (diff) | |
| download | box64-f0d7582845e124ed61b86f43da30a7b3f3f0c3f5.tar.gz box64-f0d7582845e124ed61b86f43da30a7b3f3f0c3f5.zip | |
Upgraded the wrapper helper (#1803)
* [WRAPPERHELPER] Fixed unsigned comparison in macros, added macro expanding in include commands, added -I option * [WRAPPERHELPER] Forgot the README
Diffstat (limited to 'wrapperhelper/src/cstring.h')
| -rw-r--r-- | wrapperhelper/src/cstring.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/wrapperhelper/src/cstring.h b/wrapperhelper/src/cstring.h index 14032bd6..12c7df4c 100644 --- a/wrapperhelper/src/cstring.h +++ b/wrapperhelper/src/cstring.h @@ -13,11 +13,13 @@ * string_t ------------ The string type. * string_new ---------- Creates a new string. * string_new_cap ------ Creates a new string with a given capacity. Takes the capacity. + * string_new_cstr ----- Creates a new string from a given C string. Takes the string. * string_reserve ------ Ensures a string has at least a given capacity. Takes the string and the capacity. * string_del ---------- Frees a string. Takes the string. * string_steal -------- Frees a string, keeping the content alive. Takes the string. The content (also returned) needs to be freed separately. * string_add_char ----- Add a character at the end. Takes the string and the new character. May increase the string capacity. * string_add_string --- Add a string at the end in-place. Takes both strings. May increase the string capacity. + * string_add_cstr ----- Add a C string at the end in-place. Takes both strings. May increase the string capacity. * string_pop ---------- Pops the last character. Takes the string. May reduce the string capacity. * string_dup ---------- Duplicate a string. Takes the string. Does not free the old string. * string_concat ------- Concatenate two strings. Takes both strings. Does not free any string. @@ -58,11 +60,13 @@ typedef struct string_s { string_t *string_new(void); string_t *string_new_cap(size_t cap); +string_t *string_new_cstr(const char *s); int string_reserve(string_t *s, size_t cap); void string_del(string_t *s); char *string_steal(string_t *s); int string_add_char(string_t *s, char elem); int string_add_string(string_t *s1, string_t *s2); +int string_add_cstr(string_t *s1, const char *s2); void string_pop(string_t *s); string_t *string_dup(string_t const *s); string_t *string_concat(string_t const *l, string_t const *r); |