summaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-02-28 22:03:04 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-02-28 22:08:20 +0100
commita1f6afa69bb25191d4b206e4ecba1557629330bc (patch)
tree3041324b6f0932ef036e9de230e965a4400f2b08 /src/buffer.h
First commit with project structure
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h
new file mode 100644
index 0000000..35f2bdf
--- /dev/null
+++ b/src/buffer.h
@@ -0,0 +1,27 @@
+#ifndef BUFFER_H
+#define BUFFER_H
+#include <stdbool.h>
+#include <stddef.h>
+
+#define GROW_SIZE 10
+
+typedef struct {
+ char *content;
+ size_t used;
+ size_t size;
+} growable_buffer;
+
+bool init_growable_buffer(growable_buffer *buffer);
+bool grow_growable_buffer(growable_buffer *buffer, size_t at_least);
+void free_growable_buffer(growable_buffer *buffer);
+
+
+typedef struct {
+ char *content;
+ size_t size;
+} fixed_buffer;
+
+bool init_fixed_buffer(fixed_buffer *buffer, char *orig);
+void free_fixed_buffer(fixed_buffer *buffer);
+
+#endif // BUFFER_H