commit a3f3fcffea17b7f0a58c874cb6a1465703e30c6d
parent 5c16d71ac19bb1734e98575ff17e28f97c09a612
Author: finwo <finwo@pm.me>
Date: Sat, 18 Jul 2026 22:11:30 +0200
Use upstream buffer lib instead of builtin
Diffstat:
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/.dep b/.dep
@@ -1,2 +1,3 @@
+finwo/buf https://git.finwo.net/lib/buf.c/archives/heads/main.tar.gz
cozis/tinytemplate https://git.finwo.net/misc/dep-repository/archives/heads/pkg/cozis/tinytemplate.tar.gz
graphitemaster/incbin https://git.finwo.net/misc/dep-repository/archives/heads/pkg/graphitemaster/incbin.tar.gz
diff --git a/Makefile b/Makefile
@@ -2,10 +2,10 @@
# LIBS=
SRC:=
SRC+=$(wildcard src/*.c)
-SRC+=$(filter-out src/util/buffer.c, $(wildcard src/*/*.c))
+# SRC+=$(filter-out src/util/buffer.c, $(wildcard src/*/*.c))
-# Generated
-SRC+=src/util/buffer.c
+# # Generated
+# SRC+=src/util/buffer.c
CFLAGS?=-Wall -s -O2
@@ -28,11 +28,11 @@ default: $(BIN)
lib/cozis/tinytemplate/tt:
$(MAKE) --directory lib/cozis/tinytemplate
-src/util/buffer.h: template/util/buffer.h lib/cozis/tinytemplate/tt template/util/buffer.json
- cat $< | lib/cozis/tinytemplate/tt template/util/buffer.json > $@
+# src/util/buffer.h: template/util/buffer.h lib/cozis/tinytemplate/tt template/util/buffer.json
+# cat $< | lib/cozis/tinytemplate/tt template/util/buffer.json > $@
-src/util/buffer.c: template/util/buffer.c lib/cozis/tinytemplate/tt src/util/buffer.h template/util/buffer.json
- cat $< | lib/cozis/tinytemplate/tt template/util/buffer.json > $@
+# src/util/buffer.c: template/util/buffer.c lib/cozis/tinytemplate/tt src/util/buffer.h template/util/buffer.json
+# cat $< | lib/cozis/tinytemplate/tt template/util/buffer.json > $@
%.o: %.c $(LIBS)
$(CC) $(CFLAGS) $(@:.o=.c) -D__NAME=\"$(BIN)\" -c -o $@
diff --git a/src/main.c b/src/main.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
-#include "util/buffer.h"
+#include "finwo/buf.h"
int main(int argc, char *argv[]) {
FILE *fp;
@@ -24,11 +24,11 @@ int main(int argc, char *argv[]) {
}
- struct confgen_buffer *ring = calloc(1, sizeof(struct confgen_buffer));
+ struct buf *ring = calloc(1, sizeof(struct buf));
char *intermediate = malloc(BUFSIZ);
while(!feof(fp)) {
n = fread(intermediate, 1, BUFSIZ, fp);
- confgen_buffer_append(ring, intermediate, n);
+ buf_append(ring, intermediate, n);
}
printf("Stats:\n");