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

#include <errno.h>
#include <skalibs/cbuffer.h>

int cbuffer_init (cbuffer_t *b, char *s, size_t len)
{
  if (len < 2) return (errno = EINVAL, 0) ;
  b->x = s ;
  b->a = len ;
  b->p = b->n = 0 ;
  return 1 ;
}