1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-30 14:09:13 +00:00

fix runtime debugging macros

Sadly, configure --enable-debug defines the macro DEBUG which conflicts
with the level1 debugging output macro. Rename them to DBG() and DBG2().
This commit is contained in:
Phil Sutter 2008-12-07 19:47:57 +01:00
parent e2c49531f3
commit 1a4e4b3b69
2 changed files with 11 additions and 11 deletions

View File

@ -1672,7 +1672,7 @@ int imap_command(int sockfd, const char *command, char *response, const char *ve
return -1; return -1;
} }
} }
DEBUG2("imap_command() received: %s", response); DBGP2("imap_command() received: %s", response);
response[numbytes] = '\0'; response[numbytes] = '\0';
if (strstr(response, verify) == NULL) { if (strstr(response, verify) == NULL) {
return -1; return -1;
@ -1788,7 +1788,7 @@ void *imap_thread(void *arg)
break; break;
} }
recvbuf[numbytes] = '\0'; recvbuf[numbytes] = '\0';
DEBUG2("imap_thread() received: %s", recvbuf); DBGP2("imap_thread() received: %s", recvbuf);
if (strstr(recvbuf, "* OK") != recvbuf) { if (strstr(recvbuf, "* OK") != recvbuf) {
ERR("IMAP connection failed, probably not an IMAP server"); ERR("IMAP connection failed, probably not an IMAP server");
fail++; fail++;
@ -1868,7 +1868,7 @@ void *imap_thread(void *arg)
break; break;
} }
recvbuf[numbytes] = '\0'; recvbuf[numbytes] = '\0';
DEBUG2("imap_thread() received: %s", recvbuf); DBGP2("imap_thread() received: %s", recvbuf);
if (strlen(recvbuf) > 2) { if (strlen(recvbuf) > 2) {
unsigned long messages, recent; unsigned long messages, recent;
char *buf = recvbuf; char *buf = recvbuf;
@ -1964,7 +1964,7 @@ void *imap_thread(void *arg)
} }
} }
recvbuf[numbytes] = '\0'; recvbuf[numbytes] = '\0';
DEBUG2("imap_thread() received: %s", recvbuf); DBGP2("imap_thread() received: %s", recvbuf);
if (strstr(recvbuf, "a3 OK") == NULL) { if (strstr(recvbuf, "a3 OK") == NULL) {
ERR("IMAP logout failed: %s", recvbuf); ERR("IMAP logout failed: %s", recvbuf);
fail++; fail++;
@ -2005,7 +2005,7 @@ int pop3_command(int sockfd, const char *command, char *response, const char *ve
return -1; return -1;
} }
} }
DEBUG2("pop3_command() received: %s", response); DBGP2("pop3_command() received: %s", response);
response[numbytes] = '\0'; response[numbytes] = '\0';
if (strstr(response, verify) == NULL) { if (strstr(response, verify) == NULL) {
return -1; return -1;
@ -2086,7 +2086,7 @@ void *pop3_thread(void *arg)
fail++; fail++;
break; break;
} }
DEBUG2("pop3_thread received: %s", recvbuf); DBGP2("pop3_thread received: %s", recvbuf);
recvbuf[numbytes] = '\0'; recvbuf[numbytes] = '\0';
if (strstr(recvbuf, "+OK ") != recvbuf) { if (strstr(recvbuf, "+OK ") != recvbuf) {
ERR("POP3 connection failed, probably not a POP3 server"); ERR("POP3 connection failed, probably not a POP3 server");
@ -4343,7 +4343,7 @@ static int handle_template_object(struct text_object_list **list,
for (i = 0; i < argcnt; i++) { for (i = 0; i < argcnt; i++) {
char *tmp; char *tmp;
tmp = backslash_escape(argsp[i], NULL, 0); tmp = backslash_escape(argsp[i], NULL, 0);
DEBUG2("%s: substituted arg '%s' to '%s'", tmpl, argsp[i], tmp); DBGP2("%s: substituted arg '%s' to '%s'", tmpl, argsp[i], tmp);
sprintf(argsp[i], "%s", tmp); sprintf(argsp[i], "%s", tmp);
free(tmp); free(tmp);
} }
@ -4351,7 +4351,7 @@ static int handle_template_object(struct text_object_list **list,
p = template_dup = strdup(template[template_idx]); p = template_dup = strdup(template[template_idx]);
eval_text = backslash_escape(template[template_idx], argsp, argcnt); eval_text = backslash_escape(template[template_idx], argsp, argcnt);
DEBUG("substituted %s, output is '%s'", tmpl, eval_text); DBGP("substituted %s, output is '%s'", tmpl, eval_text);
eval_list = extract_variable_text_internal(eval_text, allow_threaded); eval_list = extract_variable_text_internal(eval_text, allow_threaded);
if (eval_list) { if (eval_list) {

View File

@ -119,14 +119,14 @@ extern unsigned int text_buffer_size;
/* debugging output */ /* debugging output */
extern int global_debug_level; extern int global_debug_level;
#define __DBG(level, ...) \ #define __DBGP(level, ...) \
if (global_debug_level > level) { \ if (global_debug_level > level) { \
fprintf(stderr, "DEBUG(%d) [" __FILE__ ":%d]: ", level, __LINE__); \ fprintf(stderr, "DEBUG(%d) [" __FILE__ ":%d]: ", level, __LINE__); \
fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \ fprintf(stderr, "\n"); \
} }
#define DEBUG(...) __DBG(0, __VA_ARGS__) #define DBGP(...) __DBGP(0, __VA_ARGS__)
#define DEBUG2(...) __DBG(1, __VA_ARGS__) #define DBGP2(...) __DBGP(1, __VA_ARGS__)
struct net_stat { struct net_stat {
const char *dev; const char *dev;