blob: 5a23b3c2036bbd132e9b3e51c44131b03b096a14 [file] [log] [blame]
rsc7f111042003-12-11 18:15:57 +00001#include <u.h>
2#include <libc.h>
3#include "libString.h"
4
5
6/* return a String containing a copy of the passed char array */
7extern String*
8s_copy(char *cp)
9{
10 String *sp;
11 int len;
12
13 len = strlen(cp)+1;
14 sp = s_newalloc(len);
15 setmalloctag(sp, getcallerpc(&cp));
16 strcpy(sp->base, cp);
17 sp->ptr = sp->base + len - 1; /* point to 0 terminator */
18 return sp;
19}