13 char *dupstr(char *s);
14 char *dupcat(char *s1, ...);
16 void base64_encode_atom(unsigned char *data, int n, char *out);
18 struct bufchain_granule;
19 typedef struct bufchain_tag {
20 struct bufchain_granule *head, *tail;
21 int buffersize; /* current amount of buffered data */
24 void bufchain_init(bufchain *ch);
25 void bufchain_clear(bufchain *ch);
26 int bufchain_size(bufchain *ch);
27 void bufchain_add(bufchain *ch, void *data, int len);
28 void bufchain_prefix(bufchain *ch, void **data, int *len);
29 void bufchain_consume(bufchain *ch, int len);
30 void bufchain_fetch(bufchain *ch, void *data, int len);
33 * Debugging functions.
35 * Output goes to debug.log
37 * debug(()) (note the double brackets) is like printf().
39 * dmemdump() and dmemdumpl() both do memory dumps. The difference
40 * is that dmemdumpl() is more suited for when where the memory is is
41 * important (say because you'll be recording pointer values later
42 * on). dmemdump() is more concise.
46 void dprintf(char *fmt, ...);
47 void debug_memdump(void *buf, int len, int L);
48 #define debug(x) (dprintf x)
49 #define dmemdump(buf,len) debug_memdump (buf, len, 0);
50 #define dmemdumpl(buf,len) debug_memdump (buf, len, 1);
53 #define dmemdump(buf,len)
54 #define dmemdumpl(buf,len)
58 #define lenof(x) ( (sizeof((x))) / (sizeof(*(x))))
62 #define min(x,y) ( (x) < (y) ? (x) : (y) )
65 #define max(x,y) ( (x) > (y) ? (x) : (y) )