shithub: riscv

ref: 4b8f7a2110d80fdad0f09f376dbfd2204e2e8f8e
dir: /sys/src/libString/s_reset.c/

View raw version
#include <u.h>
#include <libc.h>
#include "String.h"

String*
s_reset(String *s)
{
	if(s != nil){
		s = s_unique(s);
		s->ptr = s->base;
		*s->ptr = '\0';
	} else
		s = s_new();
	return s;
}

String*
s_restart(String *s)
{
	s = s_unique(s);
	s->ptr = s->base;
	return s;
}