stralloc_copyb.c (250B)
1 /* ISC license. */ 2 3 #include <string.h> 4 #include <skalibs/stralloc.h> 5 6 int stralloc_copyb (stralloc *sa, char const *s, size_t n) 7 { 8 if (!n) return 1 ; 9 if (!stralloc_ready(sa, n)) return 0 ; 10 memmove(sa->s, s, n) ; 11 sa->len = n ; 12 return 1 ; 13 }