leitner a8f6a1c121 remove special case stralloc textcode functions
write generic stralloc and array textcode wrapper functions
change textcode API to use long instead of int
add cescape fmt and scan functions to textcode
add fmt_foldwhitespace to textcode
2003-09-19 19:08:13 +00:00

14 lines
352 B
C

#include "str.h"
#include "stralloc.h"
#include "textcode.h"
unsigned long scan_to_sa(unsigned long (*func)(const char*,char*,unsigned long*),
const char* src,stralloc* sa) {
unsigned long scanned;
unsigned long r;
if (!stralloc_readyplus(sa,str_len(src))) return 0;
if ((r=func(src,sa->s+sa->len,&scanned)))
sa->len+=r;
return r;
}