plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

s_array.c (322B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include "libString.h"
      4 
      5 extern String*	_s_alloc(void);
      6 
      7 /* return a String containing a character array (this had better not grow) */
      8 extern String *
      9 s_array(char *cp, int len)
     10 {
     11 	String *sp = _s_alloc();
     12 
     13 	sp->base = sp->ptr = cp;
     14 	sp->end = sp->base + len;
     15 	sp->fixed = 1;
     16 	return sp;
     17 }