diff options
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; +} |