2003-09-19 19:08:13 +00:00
|
|
|
#include "array.h"
|
|
|
|
#include "textcode.h"
|
|
|
|
|
2006-11-07 17:56:05 +00:00
|
|
|
void fmt_to_array(size_t (*func)(char*,const char*,size_t),
|
|
|
|
array* a,const char* src,size_t len) {
|
|
|
|
size_t needed=func(0,src,len);
|
2014-03-13 22:25:20 +00:00
|
|
|
if (array_bytes(a)+needed>=needed &&
|
2007-06-28 21:00:40 +00:00
|
|
|
array_allocate(a,1,array_bytes(a)+needed-1)) {
|
2004-01-06 23:26:55 +00:00
|
|
|
char* x=((char*)array_start(a))+array_bytes(a)-needed;
|
2003-09-19 19:08:13 +00:00
|
|
|
func(x,src,len);
|
|
|
|
} else
|
|
|
|
array_fail(a);
|
|
|
|
}
|