aboutsummaryrefslogtreecommitdiff
path: root/include/better_string.h
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@gmail.com>2024-12-24 21:11:06 -0800
committerPreston Pan <ret2pop@gmail.com>2024-12-24 21:11:06 -0800
commite75d6f6b8f4512a5bbfecbfa8c17f0bb687e3d55 (patch)
tree7a96002751a1ca3b173762a13b181ebea4123817 /include/better_string.h
first commit
Diffstat (limited to 'include/better_string.h')
-rw-r--r--include/better_string.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/better_string.h b/include/better_string.h
new file mode 100644
index 0000000..b23010e
--- /dev/null
+++ b/include/better_string.h
@@ -0,0 +1,22 @@
+#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_append(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