commit | 7f11104a5737adf261d10bc1a7b85e740f2eb491 | [log] [tgz] |
---|---|---|
author | rsc <devnull@localhost> | Thu Dec 11 18:15:57 2003 +0000 |
committer | rsc <devnull@localhost> | Thu Dec 11 18:15:57 2003 +0000 |
tree | 2473f5fbdd42b74b189e2fcc2a46896a50ede030 | |
parent | 57ccfb9e8f51138c33ad5f58e14c0e54246cf5c4 [diff] [blame] |
Add libString.
diff --git a/src/libString/s_putc.c b/src/libString/s_putc.c new file mode 100644 index 0000000..29a385d --- /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; +}