This basically means to unifdef DEBUG in (almost) all places.
We keep it in src/portab/portab.h so DEBUG stays available to
enable assert(). Also add a comment about this.
{
assert( Client != NULL );
-#ifdef DEBUG
if(Client->type == CLIENT_USER)
assert(strlen(Client->id) < Conf_MaxNickLength);
-#endif
if( Client->id[0] ) return Client->id;
else return "*";
} /* Client_Announce */
-#ifdef DEBUG
GLOBAL void
Client_DebugDump(void)
}
} /* Client_DumpClients */
-#endif
/* -eof- */
const char *hostname));
-#ifdef DEBUG
GLOBAL void Client_DebugDump PARAMS((void));
-#endif
#endif
{
/* Validate configuration settings. */
-#ifdef DEBUG
int i, servers, servers_once;
-#endif
bool config_valid = true;
char *ptr;
"Maximum penalty increase ('MaxPenaltyTime') is set to %ld, this is not recommended!",
Conf_MaxPenaltyTime);
-#ifdef DEBUG
servers = servers_once = 0;
for (i = 0; i < MAX_SERVERS; i++) {
if (Conf_Server[i].name[0]) {
array_length(&Conf_Opers, sizeof(struct Conf_Oper)),
servers, servers_once,
array_length(&Conf_Channels, sizeof(struct Conf_Channel)));
-#endif
return config_valid;
}
Log(Level, "%s", msg);
}
-#ifdef DEBUG
/**
* Dump internal state of the "configuration module".
}
}
-#endif
/**
* Initialize server configuration structure to default values.
/* Password required by WEBIRC command */
GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
-#ifdef DEBUG
GLOBAL void Conf_DebugDump PARAMS((void));
-#endif
#endif
Class_HandleServerBans(c);
}
-#ifdef DEBUG
else
LogDebug("Resolver: discarding result for already registered connection %d.", i);
-#endif
} /* cb_Read_Resolver_Result */
/**
#endif /* SSL_SUPPORT */
-#ifdef DEBUG
/**
* Dump internal state of the "connection module".
}
} /* Conn_DumpClients */
-#endif /* DEBUG */
/* -eof- */
GLOBAL void Conn_SetAuthPing PARAMS((CONN_ID Idx, long ID));
#endif
-#ifdef DEBUG
GLOBAL void Conn_DebugDump PARAMS((void));
-#endif
#endif
* @param Format Format string like printf().
* @param ... Further arguments.
*/
-#ifdef DEBUG
# ifdef PROTOTYPES
GLOBAL void
LogDebug( const char *Format, ... )
va_end( ap );
Log(LOG_DEBUG, "%s", msg);
}
-#endif /* DEBUG */
/**
}
else snotice = false;
-#ifdef DEBUG
if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return;
-#else
- if( Level == LOG_DEBUG ) return;
-#endif
#ifdef PROTOTYPES
va_start( ap, Format );
#ifdef SYSLOG
openlog(PACKAGE, LOG_CONS|LOG_PID, Conf_SyslogFacility);
#endif
-#ifdef DEBUG
Log_Subprocess(LOG_DEBUG, "%s sub-process starting, PID %ld.",
Name, (long)getpid());
-#endif
}
GLOBAL void
Log_Exit_Subprocess(char UNUSED *Name)
{
-#ifdef DEBUG
Log_Subprocess(LOG_DEBUG, "%s sub-process %ld done.",
Name, (long)getpid());
-#endif
#ifdef SYSLOG
closelog( );
#endif
assert(Format != NULL);
-#ifdef DEBUG
if ((Level == LOG_DEBUG) && (!NGIRCd_Debug))
return;
-#else
- if (Level == LOG_DEBUG)
- return;
-#endif
#ifdef PROTOTYPES
va_start(ap, Format);
GLOBAL void Log_ServerNotice PARAMS((char UserMode, const char *Format, ...));
-#ifdef DEBUG
GLOBAL void LogDebug PARAMS(( const char *Format, ... ));
-#else
-static inline void LogDebug PARAMS(( UNUSED const char *Format, ... )){/* Do nothing. The compiler should optimize this out, please ;-) */}
-#endif
GLOBAL void Log_Init_Subprocess PARAMS((char *Name));
GLOBAL void Log_Exit_Subprocess PARAMS((char *Name));
GLOBAL void Log_Subprocess PARAMS((const int Level, const char *Format, ...));
-#ifdef DEBUG
GLOBAL void Log_InitErrorfile PARAMS(( void ));
-#endif
#endif
NGIRCd_SignalQuit = NGIRCd_SignalRestart = false;
NGIRCd_Passive = false;
-#ifdef DEBUG
NGIRCd_Debug = false;
-#endif
#ifdef SNIFFER
NGIRCd_Sniffer = false;
#endif
configtest = true;
ok = true;
}
-#ifdef DEBUG
if (strcmp(argv[i], "--debug") == 0) {
NGIRCd_Debug = true;
ok = true;
}
-#endif
if (strcmp(argv[i], "--help") == 0) {
Show_Version();
puts(""); Show_Help( ); puts( "" );
/* short option */
for (n = 1; n < strlen(argv[i]); n++) {
ok = false;
-#ifdef DEBUG
if (argv[i][n] == 'd') {
NGIRCd_Debug = true;
ok = true;
}
-#endif
if (argv[i][n] == 'f') {
if (!argv[i][n+1] && i+1 < argc) {
/* Ok, next character is a blank */
/* Debug level for "VERSION" command */
NGIRCd_DebugLevel[0] = '\0';
-#ifdef DEBUG
if (NGIRCd_Debug)
strcpy(NGIRCd_DebugLevel, "1");
-#endif
#ifdef SNIFFER
if (NGIRCd_Sniffer) {
NGIRCd_Debug = true;
strlcat(NGIRCd_VersionAddition, "CHARCONV",
sizeof NGIRCd_VersionAddition);
#endif
-#ifdef DEBUG
if (NGIRCd_VersionAddition[0])
strlcat(NGIRCd_VersionAddition, "+",
sizeof NGIRCd_VersionAddition);
strlcat(NGIRCd_VersionAddition, "DEBUG",
sizeof NGIRCd_VersionAddition);
-#endif
#ifdef IDENTAUTH
if (NGIRCd_VersionAddition[0])
strlcat(NGIRCd_VersionAddition, "+",
static void
Show_Help( void )
{
-#ifdef DEBUG
puts( " -d, --debug log extra debug messages" );
-#endif
puts( " -f, --config <f> use file <f> as configuration file" );
puts( " -n, --nodaemon don't fork and don't detach from controlling terminal" );
puts( " -p, --passive disable automatic connections to other servers" );
/** String specifying the compile-time options and target platform */
GLOBAL char NGIRCd_VersionAddition[126];
-#ifdef DEBUG
/** Flag indicating if debug mode is active (true) or not (false) */
GLOBAL bool NGIRCd_Debug;
-#endif
#ifdef SNIFFER
/** Flag indication if sniffer is active (true) or not (false) */
char *modes, *topic, *key;
bool has_k, has_l;
-#ifdef DEBUG
Log(LOG_DEBUG, "Sending CHANINFO commands for \"%s\" ...",
Channel_Name(Chan));
-#endif
modes = Channel_Modes(Chan);
topic = Channel_Topic(Chan);
{
switch(Signal) {
case SIGTERM:
-#ifdef DEBUG
Log_Subprocess(LOG_DEBUG, "Child got TERM signal, exiting.");
-#endif
exit(1);
case SIGALRM:
-#ifdef DEBUG
Log_Subprocess(LOG_DEBUG, "Child got ALARM signal, exiting.");
-#endif
exit(1);
}
}
pid = Proc_Fork(s, pipefd, cbfunc, RESOLVER_TIMEOUT);
if (pid > 0) {
/* Main process */
-#ifdef DEBUG
Log( LOG_DEBUG, "Resolver for \"%s\" created (PID %d).", Host, pid );
-#endif
return true;
} else if( pid == 0 ) {
/* Sub process */
if (identsock < 0)
return;
-#ifdef DEBUG
Log_Subprocess(LOG_DEBUG, "Doing IDENT lookup on socket %d ...",
identsock);
-#endif
res = ident_id( identsock, 10 );
-#ifdef DEBUG
Log_Subprocess(LOG_DEBUG, "Ok, IDENT lookup on socket %d done: \"%s\"",
identsock, res ? res : "(NULL)");
-#endif
if (!res) /* no result */
return;
if (!array_cats(resolved_addr, res))
array_init(&resolved_addr);
ng_ipaddr_tostr_r(Addr, tmp_ip_str);
-#ifdef DEBUG
Log_Subprocess(LOG_DEBUG, "Now resolving %s ...", tmp_ip_str);
-#endif
if (!ReverseLookup(Addr, hostname, sizeof(hostname)))
goto dns_done;
Log_Forgery_NoIP(tmp_ip_str, hostname);
strlcpy(hostname, tmp_ip_str, sizeof(hostname));
}
-#ifdef DEBUG
Log_Subprocess(LOG_DEBUG, "Ok, translated %s to \"%s\".", tmp_ip_str, hostname);
-#endif
dns_done:
len = strlen(hostname);
hostname[len] = '\n';
* to parent. */
array IpAddrs;
int af;
-#ifdef DEBUG
ng_ipaddr_t *addr;
size_t len;
-#endif
Log_Subprocess(LOG_DEBUG, "Now resolving \"%s\" ...", Host);
array_init(&IpAddrs);
close(w_fd);
return;
}
-#ifdef DEBUG
len = array_length(&IpAddrs, sizeof(*addr));
assert(len > 0);
addr = array_start(&IpAddrs);
Log_Subprocess(LOG_DEBUG, "translated \"%s\" to %s.",
Host, ng_ipaddr_tostr(addr));
}
-#endif
/* Write result into pipe to parent */
ArrayWrite(w_fd, &IpAddrs);
SIGINT, SIGQUIT, SIGTERM, SIGHUP, SIGCHLD, SIGUSR1, SIGUSR2
};
-#ifdef DEBUG
static void
Dump_State(void)
LogDebug("--- End of state dump ---");
} /* Dump_State */
-#endif
static void
Signal_Block(int sig)
while (waitpid( -1, NULL, WNOHANG) > 0)
;
return;
-#ifdef DEBUG
case SIGUSR1:
if (! NGIRCd_Debug) {
Log(LOG_INFO|LOG_snotice,
#endif /* SNIFFER */
}
return;
-#endif
}
/*
/* re-read configuration */
Rehash();
break;
-#ifdef DEBUG
case SIGUSR2:
if (NGIRCd_Debug) {
Log(LOG_INFO|LOG_snotice,
break;
default:
LogDebug("Got signal %d! Ignored.", Signal);
-#endif
}
Signal_Unblock(Signal);
}
#include "config.h"
+/* remove assert() macro at compile time if DEBUG is not set. */
+
#ifndef DEBUG
# define NDEBUG
#endif