diff options
author | rsc <devnull@localhost> | 2003-12-11 18:15:57 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-12-11 18:15:57 +0000 |
commit | 7f11104a5737adf261d10bc1a7b85e740f2eb491 (patch) | |
tree | 2473f5fbdd42b74b189e2fcc2a46896a50ede030 /src/libString/s_terminate.c | |
parent | 57ccfb9e8f51138c33ad5f58e14c0e54246cf5c4 (diff) | |
download | plan9port-7f11104a5737adf261d10bc1a7b85e740f2eb491.tar.gz plan9port-7f11104a5737adf261d10bc1a7b85e740f2eb491.tar.bz2 plan9port-7f11104a5737adf261d10bc1a7b85e740f2eb491.zip |
Add libString.
Diffstat (limited to 'src/libString/s_terminate.c')
-rw-r--r-- | src/libString/s_terminate.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libString/s_terminate.c b/src/libString/s_terminate.c new file mode 100644 index 00000000..dc893ab2 --- /dev/null +++ b/src/libString/s_terminate.c @@ -0,0 +1,13 @@ +#include <u.h> +#include <libc.h> +#include "libString.h" + +void +s_terminate(String *s) +{ + if(s->ref > 1) + sysfatal("can't s_terminate a shared string"); + if (s->ptr >= s->end) + s_grow(s, 1); + *s->ptr = 0; +} |