envalloc_make.c (522B)
1 /* ISC license. */ 2 3 #include <skalibs/env.h> 4 #include <skalibs/genalloc.h> 5 #include <skalibs/envalloc.h> 6 7 int envalloc_make (genalloc *v, size_t argc, char const *s, size_t len) 8 { 9 int wasnull = !v->s ; 10 if (!genalloc_readyplus(char const *, v, argc+1)) return 0 ; 11 if (!env_make(genalloc_s(char const *, v) + genalloc_len(char const *, v), argc, s, len)) 12 { 13 if (wasnull) genalloc_free(char const *, v) ; 14 return 0 ; 15 } 16 genalloc_setlen(char const *, v, genalloc_len(char const *, v) + argc) ; 17 return 1 ; 18 }