2003-09-19 19:08:13 +00:00
|
|
|
#include "str.h"
|
|
|
|
#include "stralloc.h"
|
|
|
|
#include "textcode.h"
|
|
|
|
|
2006-11-07 17:56:05 +00:00
|
|
|
size_t scan_to_sa(size_t (*func)(const char*,char*,size_t*),
|
2003-09-19 19:08:13 +00:00
|
|
|
const char* src,stralloc* sa) {
|
2006-11-07 17:56:05 +00:00
|
|
|
size_t written;
|
|
|
|
size_t r;
|
2003-09-19 19:08:13 +00:00
|
|
|
if (!stralloc_readyplus(sa,str_len(src))) return 0;
|
2005-06-08 04:08:18 +00:00
|
|
|
if ((r=func(src,sa->s+sa->len,&written)))
|
|
|
|
sa->len+=written;
|
2003-09-19 19:08:13 +00:00
|
|
|
return r;
|
|
|
|
}
|