File: fmt_to_array.c

package info (click to toggle)
libowfat 0.22-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,148 kB
  • ctags: 976
  • sloc: ansic: 10,424; makefile: 42
file content (12 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
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=((char*)array_start(a))+array_bytes(a)-needed;
    func(x,src,len);
  } else
    array_fail(a);
}