libowfat/stralloc/stralloc_readyplus.c
leitner 5eb1cdf888 cleanups in stralloc and buffer:
int -> long for sizes
    char -> unsigned char for strings
2004-11-25 21:29:35 +00:00

14 lines
424 B
C

#include "stralloc.h"
#include <stdlib.h>
/* stralloc_readyplus is like stralloc_ready except that, if sa is
* already allocated, stralloc_readyplus adds the current length of sa
* to len. */
int stralloc_readyplus(stralloc *sa,unsigned long len) {
if (sa->s) {
if (sa->len + len < len) return 0; /* catch integer overflow */
return stralloc_ready(sa,sa->len+len);
} else
return stralloc_ready(sa,len);
}