13 char *dupstr(char *s
);
14 char *dupcat(char *s1
, ...);
16 struct bufchain_granule
;
17 typedef struct bufchain_tag
{
18 struct bufchain_granule
*head
, *tail
;
19 int buffersize
; /* current amount of buffered data */
22 void bufchain_init(bufchain
*ch
);
23 void bufchain_clear(bufchain
*ch
);
24 int bufchain_size(bufchain
*ch
);
25 void bufchain_add(bufchain
*ch
, void *data
, int len
);
26 void bufchain_prefix(bufchain
*ch
, void **data
, int *len
);
27 void bufchain_consume(bufchain
*ch
, int len
);
30 * Debugging functions.
32 * Output goes to debug.log
34 * debug(()) (note the double brackets) is like printf().
36 * dmemdump() and dmemdumpl() both do memory dumps. The difference
37 * is that dmemdumpl() is more suited for when where the memory is is
38 * important (say because you'll be recording pointer values later
39 * on). dmemdump() is more concise.
43 void dprintf(char *fmt
, ...);
44 void debug_memdump(void *buf
, int len
, int L
);
45 #define debug(x) (dprintf x)
46 #define dmemdump(buf,len) debug_memdump (buf, len, 0);
47 #define dmemdumpl(buf,len) debug_memdump (buf, len, 1);
50 #define dmemdump(buf,len)
51 #define dmemdumpl(buf,len)
56 #define lenof(x) ( (sizeof((x))) / (sizeof(*(x))))