stralloc_shrink.c (237B)
1 /* ISC license. */ 2 3 #include <skalibs/alloc.h> 4 #include <skalibs/stralloc.h> 5 6 int stralloc_shrink (stralloc *sa) 7 { 8 if (sa->a > sa->len) 9 { 10 if (!alloc_re(&sa->s, sa->a, sa->len)) return 0 ; 11 sa->a = sa->len ; 12 } 13 return 1 ; 14 }