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:
12
textcode/scan_to_array.c
Normal file
12
textcode/scan_to_array.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "str.h"
|
||||
#include "array.h"
|
||||
#include "textcode.h"
|
||||
|
||||
unsigned long scan_to_array(unsigned long (*func)(const char*,char*,unsigned long*),
|
||||
const char* src,array* dest) {
|
||||
unsigned long scanned;
|
||||
unsigned long needed=str_len(src);
|
||||
char* x=array_start(dest)+array_bytes(dest);
|
||||
if (!array_allocate(dest,1,array_bytes(dest)+needed-1)) return 0;
|
||||
return func(src,x,&scanned);
|
||||
}
|
||||
Reference in New Issue
Block a user