2003-09-19 19:08:13 +00:00
|
|
|
#include "str.h"
|
|
|
|
#include "array.h"
|
|
|
|
#include "textcode.h"
|
|
|
|
|
2006-11-07 17:56:05 +00:00
|
|
|
size_t scan_to_array(size_t (*func)(const char*,char*,size_t*),
|
2003-09-19 19:08:13 +00:00
|
|
|
const char* src,array* dest) {
|
2006-11-07 17:56:05 +00:00
|
|
|
size_t scanned;
|
|
|
|
size_t needed=str_len(src);
|
2004-01-06 23:26:55 +00:00
|
|
|
char* x=((char*)array_start(dest))+array_bytes(dest);
|
2003-09-19 19:08:13 +00:00
|
|
|
if (!array_allocate(dest,1,array_bytes(dest)+needed-1)) return 0;
|
|
|
|
return func(src,x,&scanned);
|
|
|
|
}
|