db9c0f86 |
1 | #ifndef PUTTY_MISC_H |
2 | #define PUTTY_MISC_H |
3 | |
4 | #include "puttymem.h" |
5 | |
6 | |
7 | /* |
8 | * Debugging functions. |
9 | * |
10 | * Output goes to debug.log |
11 | * |
12 | * debug(()) (note the double brackets) is like printf(). |
13 | * |
14 | * dmemdump() and dmemdumpl() both do memory dumps. The difference |
15 | * is that dmemdumpl() is more suited for when where the memory is is |
16 | * important (say because you'll be recording pointer values later |
17 | * on). dmemdump() is more concise. |
18 | */ |
19 | |
20 | #ifdef DEBUG |
21 | void dprintf(char *fmt, ...); |
22 | void debug_memdump (void *buf, int len, int L); |
23 | #define debug(x) (dprintf x) |
24 | #define dmemdump(buf,len) debug_memdump (buf, len, 0); |
25 | #define dmemdumpl(buf,len) debug_memdump (buf, len, 1); |
26 | #else |
27 | #define debug(x) |
28 | #define dmemdump(buf,len) |
29 | #define dmemdumpl(buf,len) |
30 | #endif |
31 | |
32 | |
33 | #ifndef lenof |
34 | #define lenof(x) ( (sizeof((x))) / (sizeof(*(x)))) |
35 | #endif |
36 | |
37 | |
38 | #endif |