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
This commit is contained in:
leitner
2003-09-19 19:08:13 +00:00
parent e86a457f5c
commit a8f6a1c121
40 changed files with 218 additions and 477 deletions

12
textcode/fmt_to_array.c Normal file
View File

@@ -0,0 +1,12 @@
#include "array.h"
#include "textcode.h"
void fmt_to_array(unsigned long (*func)(char*,const char*,unsigned long),
array* a,const char* src,unsigned long len) {
unsigned long needed=func(0,src,len);
if (array_allocate(a,1,array_bytes(a)+needed-1)) {
char* x=array_start(a)+array_bytes(a)-needed;
func(x,src,len);
} else
array_fail(a);
}