summaryrefslogtreecommitdiff
path: root/src/libstddjb/stralloc_copyb.c
blob: f32c3e57c42c900a1df2bc2d7bdc28e389654144 (plain)
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 ;
}