From 07d16903f3c4f8be84e777a2067085f305e8d2f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 3 Mar 2017 22:35:09 +0100 Subject: api: add dynamic string functions (string_dyn_*) New functions: - string_dyn_alloc - string_dyn_copy - string_dyn_concat - string_dyn_free --- src/core/wee-string.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/core/wee-string.h') 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 #include +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 */ -- cgit v1.2.3