summaryrefslogtreecommitdiff
path: root/src/common/strlib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/strlib.h')
-rw-r--r--src/common/strlib.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/common/strlib.h b/src/common/strlib.h
index 42fb75ab2..ee473f466 100644
--- a/src/common/strlib.h
+++ b/src/common/strlib.h
@@ -7,6 +7,7 @@
#ifndef _CBASETYPES_H_
#include "../common/cbasetypes.h"
#endif
+#include <stdarg.h>
char* jstrescape (char* pt);
char* jstrescapecpy (char* pt, const char* spt);
@@ -33,4 +34,25 @@ int config_switch(const char* str);
/// always nul-terminates the string
char* safestrncpy(char* dst, const char* src, size_t n);
+/// StringBuf - dynamic string
+struct StringBuf
+{
+ char *buf_;
+ char *ptr_;
+ unsigned int max_;
+};
+typedef struct StringBuf StringBuf;
+
+StringBuf* StringBuf_Malloc(void);
+void StringBuf_Init(StringBuf* self);
+int StringBuf_Printf(StringBuf* self, const char* fmt, ...);
+int StringBuf_Vprintf(StringBuf* self, const char* fmt, va_list args);
+int StringBuf_Append(StringBuf* self, const StringBuf *sbuf);
+int StringBuf_AppendStr(StringBuf* self, const char* str);
+int StringBuf_Length(StringBuf* self);
+char* StringBuf_Value(StringBuf* self);
+void StringBuf_Clear(StringBuf* self);
+void StringBuf_Destroy(StringBuf* self);
+void StringBuf_Free(StringBuf* self);
+
#endif /* _STRLIB_H_ */