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/ctor.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 bittorrent/mbtstr/src/ctor.c (limited to 'bittorrent/mbtstr/src/ctor.c') diff --git a/bittorrent/mbtstr/src/ctor.c b/bittorrent/mbtstr/src/ctor.c new file mode 100644 index 0000000..5354f88 --- /dev/null +++ b/bittorrent/mbtstr/src/ctor.c @@ -0,0 +1,19 @@ +#include +#include + +#include "mbtstr/str.h" + +bool mbt_str_ctor(struct mbt_str *str, size_t capacity) +{ + str->size = 0; + str->capacity = capacity; + if (str->capacity == 0) + { + str->data = NULL; + return true; + } + str->data = calloc(capacity + 1, 1); + if (str->data == NULL) + return false; + return true; +} -- cgit v1.2.3