Files
mars-libowfat/textcode/fmt_to_sa.c
2025-01-20 18:07:12 +00:00

12 lines
319 B
C

#include <libowfat/stralloc.h>
#include <libowfat/textcode.h>
int fmt_to_sa(size_t (*func)(char*,const char*,size_t),
stralloc* sa,const char* src,size_t len) {
size_t needed=func(0,src,len);
if (!stralloc_readyplus(sa,needed)) return 0;
func(sa->s+sa->len,src,len);
sa->len+=needed;
return needed;
}