diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-03-03 22:35:09 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-03-25 14:18:19 +0100 |
commit | 07d16903f3c4f8be84e777a2067085f305e8d2f0 (patch) | |
tree | 964063edee2de816033db0ceae55984f4d595b12 /src/core/wee-string.h | |
parent | a5b00ec9793b0a8a20074ffb801615c347e66709 (diff) | |
download | weechat-07d16903f3c4f8be84e777a2067085f305e8d2f0.zip |
api: add dynamic string functions (string_dyn_*)
New functions:
- string_dyn_alloc
- string_dyn_copy
- string_dyn_concat
- string_dyn_free
Diffstat (limited to 'src/core/wee-string.h')
-rw-r--r-- | src/core/wee-string.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/wee-string.h b/src/core/wee-string.h index fc7ba8dd2..bfed81411 100644 --- a/src/core/wee-string.h +++ b/src/core/wee-string.h @@ -20,8 +20,19 @@ #ifndef WEECHAT_STRING_H #define WEECHAT_STRING_H 1 +#include <stdint.h> #include <regex.h> +typedef uint32_t string_shared_count_t; + +typedef uint32_t string_dyn_size_t; +struct t_string_dyn +{ + char *string; /* the string */ + string_dyn_size_t size_alloc; /* allocated size */ + string_dyn_size_t size; /* size of string (including '\0') */ +}; + struct t_hashtable; extern char *string_strndup (const char *string, int length); @@ -104,6 +115,10 @@ extern char *string_replace_with_callback (const char *string, int *errors); extern const char *string_shared_get (const char *string); extern void string_shared_free (const char *string); +extern char **string_dyn_alloc (int size_alloc); +extern int string_dyn_copy (char **string, const char *new_string); +extern int string_dyn_concat (char **string, const char *add); +extern void string_dyn_free (char **string, int free_string); extern void string_end (); #endif /* WEECHAT_STRING_H */ |