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