aboutsummaryrefslogtreecommitdiff
path: root/lib/bob/u8strpushu8.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bob/u8strpushu8.c')
-rw-r--r--lib/bob/u8strpushu8.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/bob/u8strpushu8.c b/lib/bob/u8strpushu8.c
new file mode 100644
index 0000000..8358e01
--- /dev/null
+++ b/lib/bob/u8strpushu8.c
@@ -0,0 +1,14 @@
+#include <string.h>
+
+#include "bob.h"
+#include "mbstring.h"
+
+struct u8str *
+u8strpushu8(struct u8str *b, struct u8view v)
+{
+ if (!u8strgrow(b, b->len + v.len))
+ return nullptr;
+ memcpy(b->p + b->len, v.p, v.len);
+ b->len += v.len;
+ return b;
+}