aboutsummaryrefslogtreecommitdiff
path: root/src/include/better_string.h
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@gmail.com>2024-12-28 16:47:43 -0800
committerPreston Pan <ret2pop@gmail.com>2024-12-28 16:47:43 -0800
commit1fd608288ee47c2c560817f12f14b21069fed2f6 (patch)
treee6460b92dba5bb0d089c8c2a4e794e3504098359 /src/include/better_string.h
parent63f11aaec8d21844a07fd27003a992c102a3a297 (diff)
makefile and directory structure change completely to build client and server
Diffstat (limited to 'src/include/better_string.h')
-rw-r--r--src/include/better_string.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/include/better_string.h b/src/include/better_string.h
new file mode 100644
index 0000000..41c0cfd
--- /dev/null
+++ b/src/include/better_string.h
@@ -0,0 +1,24 @@
+#ifndef STRING_H
+#define STRING_H
+
+#include <stdlib.h>
+#define DEFAULT_STR_SIZE 10
+
+typedef struct {
+ char *buf;
+ size_t len;
+ size_t size;
+} string_t;
+
+string_t *init_string(const char *source);
+
+void string_push(string_t *s, char c);
+
+void string_concat(string_t *s1, string_t *s2);
+
+void string_concat_const(string_t *s, const char *src);
+
+char string_pop(string_t *s);
+
+void string_free(void *s);
+#endif