aboutsummaryrefslogtreecommitdiff
path: root/src/std
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-07-22 18:48:30 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-22 18:48:30 +0200
commite9e41c02d4309cd50b5584a8dfc0d7e01cb27e10 (patch)
tree365b00dba760153e8d88fa143fb7e15a2a1a6448 /src/std
parent93db3b8726f6d7574b71926285e86135e822f9d3 (diff)
Kill child process when parent dies
Diffstat (limited to 'src/std')
-rw-r--r--src/std/buffer.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/std/buffer.c b/src/std/buffer.c
index b0099bb..0936573 100644
--- a/src/std/buffer.c
+++ b/src/std/buffer.c
@@ -12,6 +12,7 @@ void tsl_buffer_init(TslBuffer *self) {
void tsl_buffer_deinit(TslBuffer *self) {
free(self->data);
+ self->data = NULL;
self->size = 0;
self->capacity = 0;
}
@@ -26,7 +27,7 @@ static int tsl_buffer_ensure_capacity(TslBuffer *self, size_t new_size) {
new_capacity = 8;
while(new_capacity < new_size) {
- new_capacity <<= 1;
+ new_capacity += (new_capacity >> 1);
}
new_ptr = realloc(self->data, new_capacity);
@@ -54,11 +55,6 @@ void* tsl_buffer_pop(TslBuffer *self, size_t size) {
return (char*)self->data + self->size;
}
-void* tsl_buffer_top(TslBuffer *self, size_t data_size) {
- tsl_buffer_pop(self, data_size);
- return (char*)self->data + self->size;
-}
-
void* tsl_buffer_begin(TslBuffer *self) {
return self->data;
}