summaryrefslogtreecommitdiff
path: root/bittorrent/mbtstr/src/pushc.c
diff options
context:
space:
mode:
authorMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
committerMartial Simon <msimon_fr@hotmail.com>2025-09-15 01:07:58 +0200
commit967be9e750221ab2ab783f95df79bb26d290a45e (patch)
tree6802900a5e975f9f68b169f0f503f040056d6952 /bittorrent/mbtstr/src/pushc.c
add: added projectsHEADmain
Diffstat (limited to 'bittorrent/mbtstr/src/pushc.c')
-rw-r--r--bittorrent/mbtstr/src/pushc.c18
1 files changed, 18 insertions, 0 deletions
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 <stdlib.h>
+
+#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;
+}