| Line | |
|---|
| 1 | #ifndef _LINK_DEBUG_H
|
|---|
| 2 | #define _LINK_DEBUG_H
|
|---|
| 3 |
|
|---|
| 4 | /* Enables debug printout for the socket / connection */
|
|---|
| 5 | #undef CONNECTION_DEBUG
|
|---|
| 6 |
|
|---|
| 7 | /* If CONNECTION_DEBUG is defined, define this to make it selectable
|
|---|
| 8 | * at runtime by setting the LINK_CONNECTION_DEBUG env var.
|
|---|
| 9 | */
|
|---|
| 10 | #define CONNECTION_DEBUG_FLAG
|
|---|
| 11 |
|
|---|
| 12 | #ifndef CONNECTION_DEBUG
|
|---|
| 13 | # ifdef G_HAVE_ISO_VARARGS
|
|---|
| 14 | # define d_printf(...)
|
|---|
| 15 | # elif defined(G_HAVE_GNUC_VARARGS)
|
|---|
| 16 | # define d_printf(args...)
|
|---|
| 17 | # else
|
|---|
| 18 | static inline void d_printf (const char *format, ...)
|
|---|
| 19 | {
|
|---|
| 20 | }
|
|---|
| 21 | # endif
|
|---|
| 22 | # define STATE_NAME(s) ""
|
|---|
| 23 | #else
|
|---|
| 24 | # include <stdio.h>
|
|---|
| 25 | # define STATE_NAME(s) (((s) == LINK_CONNECTED) ? "Connected" : \
|
|---|
| 26 | ((s) == LINK_CONNECTING) ? "Connecting" : \
|
|---|
| 27 | ((s) == LINK_DISCONNECTED) ? "Disconnected" : \
|
|---|
| 28 | "Invalid state")
|
|---|
| 29 | # ifdef CONNECTION_DEBUG_FLAG
|
|---|
| 30 | extern gboolean link_connection_debug_flag;
|
|---|
| 31 | # define d_printf(format...) (link_connection_debug_flag ? (fprintf (stderr, format), fflush (stderr)) : 0)
|
|---|
| 32 | # else
|
|---|
| 33 | # define d_printf(format...) fprintf (stderr, format)
|
|---|
| 34 | # endif
|
|---|
| 35 | #endif
|
|---|
| 36 |
|
|---|
| 37 | #endif /* _LINK_DEBUG_H */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.