s_terminate.c 204 B

12345678910111213
  1. #include <u.h>
  2. #include <libc.h>
  3. #include "String.h"
  4. void
  5. s_terminate(String *s)
  6. {
  7. if(s->ref > 1)
  8. sysfatal("can't s_terminate a shared string");
  9. if (s->ptr >= s->end)
  10. s_grow(s, 1);
  11. *s->ptr = 0;
  12. }