6 struct bufchain_granule
;
7 typedef struct bufchain_tag
{
8 struct bufchain_granule
*head
, *tail
;
9 int buffersize
; /* current amount of buffered data */
12 void bufchain_init(bufchain
*ch
);
13 void bufchain_clear(bufchain
*ch
);
14 int bufchain_size(bufchain
*ch
);
15 void bufchain_add(bufchain
*ch
, void *data
, int len
);
16 void bufchain_prefix(bufchain
*ch
, void **data
, int *len
);
17 void bufchain_consume(bufchain
*ch
, int len
);
20 * Debugging functions.
22 * Output goes to debug.log
24 * debug(()) (note the double brackets) is like printf().
26 * dmemdump() and dmemdumpl() both do memory dumps. The difference
27 * is that dmemdumpl() is more suited for when where the memory is is
28 * important (say because you'll be recording pointer values later
29 * on). dmemdump() is more concise.
33 void dprintf(char *fmt
, ...);
34 void debug_memdump(void *buf
, int len
, int L
);
35 #define debug(x) (dprintf x)
36 #define dmemdump(buf,len) debug_memdump (buf, len, 0);
37 #define dmemdumpl(buf,len) debug_memdump (buf, len, 1);
40 #define dmemdump(buf,len)
41 #define dmemdumpl(buf,len)
46 #define lenof(x) ( (sizeof((x))) / (sizeof(*(x))))