1 #ifndef _DYNSTRING_H 2 #define _DYNSTRING_H 3 4 typedef struct { 5 int len,alloc; 6 char *buf; 7 } DYN_STRING; 8 9 int dyn_init(DYN_STRING *ds,int reserve_size); // -1 on error 10 void dyn_free(DYN_STRING *ds); 11 int dyn_ensure(DYN_STRING *ds,int free_space); 12 int dyn_printf(DYN_STRING *ds,const char *fmt,...) // appends 13 __attribute__((format(printf, 2, 3))); 14 15 #endif 16 17