code: plan9front

ref: d376fac66cbd5efbe2f9f61a1e8b31af03a84a92
dir: /sys/src/libString/s_array.c/

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

extern String*	_s_alloc(void);

/* return a String containing a character array (this had better not grow) */
extern String *
s_array(char *cp, int len)
{
	String *sp = _s_alloc();

	sp->base = sp->ptr = cp;
	sp->end = sp->base + len;
	sp->fixed = 1;
	return sp;
}