aboutsummaryrefslogtreecommitdiff
path: root/src/libString/s_reset.c
blob: cd2a7421b548229c6ee48ef971416fc0e2362e93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <u.h>
#include <libc.h>
#include "libString.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;
}