summaryrefslogtreecommitdiff
path: root/src/libstddjb/stralloc_copyb.c
blob: 31fc31e45dddc83120a5a01ce9a8d6f3b57d8bdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* ISC license. */

#include <sys/types.h>
#include <string.h>
#include <skalibs/stralloc.h>

int stralloc_copyb (stralloc *sa, char const *s, size_t n)
{
  if (!stralloc_ready(sa, n)) return 0 ;
  memmove(sa->s, s, n) ;
  sa->len = n ;
  return 1 ;
}