stralloc_catb.c (338B)
1 /* Public domain. */ 2 3 #include "stralloc.h" 4 #include "byte.h" 5 6 int stralloc_catb(stralloc *sa,const char *s,unsigned int n) 7 { 8 if (!sa->s) return stralloc_copyb(sa,s,n); 9 if (!stralloc_readyplus(sa,n + 1)) return 0; 10 byte_copy(sa->s + sa->len,n,s); 11 sa->len += n; 12 sa->s[sa->len] = 'Z'; /* ``offensive programming'' */ 13 return 1; 14 }