aboutsummaryrefslogtreecommitdiff
path: root/src/libString/s_putc.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2003-12-11 18:15:57 +0000
committerrsc <devnull@localhost>2003-12-11 18:15:57 +0000
commit7f11104a5737adf261d10bc1a7b85e740f2eb491 (patch)
tree2473f5fbdd42b74b189e2fcc2a46896a50ede030 /src/libString/s_putc.c
parent57ccfb9e8f51138c33ad5f58e14c0e54246cf5c4 (diff)
downloadplan9port-7f11104a5737adf261d10bc1a7b85e740f2eb491.tar.gz
plan9port-7f11104a5737adf261d10bc1a7b85e740f2eb491.tar.bz2
plan9port-7f11104a5737adf261d10bc1a7b85e740f2eb491.zip
Add libString.
Diffstat (limited to 'src/libString/s_putc.c')
-rw-r--r--src/libString/s_putc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libString/s_putc.c b/src/libString/s_putc.c
new file mode 100644
index 00000000..29a385d7
--- /dev/null
+++ b/src/libString/s_putc.c
@@ -0,0 +1,13 @@
+#include <u.h>
+#include <libc.h>
+#include "libString.h"
+
+void
+s_putc(String *s, int c)
+{
+ if(s->ref > 1)
+ sysfatal("can't s_putc a shared string");
+ if (s->ptr >= s->end)
+ s_grow(s, 2);
+ *(s->ptr)++ = c;
+}