aboutsummaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2025-01-11 23:10:24 -0700
committerRandy Palamar <randy@rnpnr.xyz>2025-01-11 23:27:47 -0700
commitabf6384cca0f80fe7dfb35a8e2281d8664d9d459 (patch)
treebc141b463e155b2170d2d70e9bb340614d76644d /buffer.c
parent72c26fc09af79ce217575a9b0f0d5058c336d5d7 (diff)
downloadvis-abf6384cca0f80fe7dfb35a8e2281d8664d9d459.tar.gz
vis-abf6384cca0f80fe7dfb35a8e2281d8664d9d459.tar.xz
buffer: delete pointless buffer_init function
lets not make the code harder to read for no reason
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/buffer.c b/buffer.c
index e9285fe..67da2e0 100644
--- a/buffer.c
+++ b/buffer.c
@@ -10,10 +10,6 @@
#define BUFFER_SIZE 1024
#endif
-void buffer_init(Buffer *buf) {
- memset(buf, 0, sizeof *buf);
-}
-
bool buffer_reserve(Buffer *buf, size_t size) {
/* ensure minimal buffer size, to avoid repeated realloc(3) calls */
if (size < BUFFER_SIZE)
@@ -45,7 +41,7 @@ void buffer_release(Buffer *buf) {
if (!buf)
return;
free(buf->data);
- buffer_init(buf);
+ *buf = (Buffer){0};
}
void buffer_clear(Buffer *buf) {
@@ -179,7 +175,7 @@ const char *buffer_content0(Buffer *buf) {
char *buffer_move(Buffer *buf) {
char *data = buf->data;
- buffer_init(buf);
+ *buf = (Buffer){0};
return data;
}