From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- bittorrent/mbtstr/src/pushc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bittorrent/mbtstr/src/pushc.c (limited to 'bittorrent/mbtstr/src/pushc.c') diff --git a/bittorrent/mbtstr/src/pushc.c b/bittorrent/mbtstr/src/pushc.c new file mode 100644 index 0000000..d63d3d0 --- /dev/null +++ b/bittorrent/mbtstr/src/pushc.c @@ -0,0 +1,18 @@ +#include + +#include "mbtstr/str.h" + +bool mbt_str_pushc(struct mbt_str *str, char c) +{ + str->size += 1; + if (str->size >= str->capacity) + { + str->capacity = str->size; + str->data = realloc(str->data, str->capacity + 1); + if (str->data == NULL) + return false; + } + str->data[str->size - 1] = c; + str->data[str->size] = 0; + return true; +} -- cgit v1.2.3