repo: ngircd action: commit revision: path_from: revision_from: 93e36555e3f03bd1375f8c35913c54459604c7c2: path_to: revision_to:
commit 93e36555e3f03bd1375f8c35913c54459604c7c2 Author: Jules MaselbasDate: Tue Apr 26 15:41:28 2022 +0200 Convert uses of Log(LOG_DEBUG, ...) to LogDebug() diff --git a/src/ngircd/array.c b/src/ngircd/array.c
--- a/src/ngircd/array.c
+++ b/src/ngircd/array.c
@@ -68,7 +68,7 @@ array_alloc(array * a, size_t size, size_t pos)
if (a->allocated < alloc) {
#if DEBUG_ARRAY
- Log(LOG_DEBUG, "array_alloc(): changing size from %u to %u bytes.",
+ LogDebug("array_alloc(): changing size from %u to %u bytes.",
a->allocated, alloc);
#endif
tmp = realloc(a->mem, alloc);
@@ -169,7 +169,7 @@ array_catb(array * dest, const char *src, size_t len)
assert(ptr != NULL);
#if DEBUG_ARRAY
- Log(LOG_DEBUG,
+ LogDebug(
"array_catb(): appending %u bytes to array (now %u bytes in array).",
len, tmp);
#endif
@@ -249,7 +249,7 @@ array_free(array * a)
{
assert(a != NULL);
#if DEBUG_ARRAY
- Log(LOG_DEBUG,
+ LogDebug(
"array_free(): %u bytes free'd (%u bytes still used at time of free()).",
a->allocated, a->used);
#endif
@@ -315,7 +315,7 @@ array_moveleft(array * a, size_t membersize, size_t pos)
return; /* nothing to do */
#if DEBUG_ARRAY
- Log(LOG_DEBUG,
+ LogDebug(
"array_moveleft(): %u bytes used in array, starting at position %u.",
a->used, bytepos);
#endif
diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c
--- a/src/ngircd/channel.c
+++ b/src/ngircd/channel.c
@@ -148,7 +148,7 @@ Channel_InitPredefined( void )
for (n = 0; n < conf_chan->modes_num; n++) {
Req.argc = 1;
strlcpy(modes, conf_chan->modes[n], sizeof(modes));
- Log(LOG_DEBUG, "Evaluate \"MODE %s %s\".", name, modes);
+ LogDebug("Evaluate \"MODE %s %s\".", name, modes);
c = strtok(modes, " ");
while (c && Req.argc < 15) {
Req.argv[Req.argc++] = c;
diff --git a/src/ngircd/client.c b/src/ngircd/client.c
--- a/src/ngircd/client.c
+++ b/src/ngircd/client.c
@@ -1499,9 +1499,7 @@ Client_RegisterWhowas( CLIENT *Client )
slot = Last_Whowas + 1;
if( slot >= MAX_WHOWAS || slot < 0 ) slot = 0;
-#ifdef DEBUG
- Log( LOG_DEBUG, "Saving WHOWAS information to slot %d ...", slot );
-#endif
+ LogDebug( "Saving WHOWAS information to slot %d ...", slot );
My_Whowas[slot].time = now;
strlcpy( My_Whowas[slot].id, Client_ID( Client ),
@@ -1703,10 +1701,10 @@ Client_DebugDump(void)
{
CLIENT *c;
- Log(LOG_DEBUG, "Client status:");
+ LogDebug("Client status:");
c = My_Clients;
while (c) {
- Log(LOG_DEBUG,
+ LogDebug(
" - %s: type=%d, host=%s, user=%s, conn=%d, start=%ld, flags=%s",
Client_ID(c), Client_Type(c), Client_Hostname(c),
Client_User(c), Client_Conn(c), Client_StartTime(c),
diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c
--- a/src/ngircd/conf.c
+++ b/src/ngircd/conf.c
@@ -942,16 +942,13 @@ Read_Config(bool TestOnly, bool IsStarting)
if( Conf_Server[i].conn_id == Conf_Server[n].conn_id ) {
Init_Server_Struct( &Conf_Server[n] );
-#ifdef DEBUG
- Log(LOG_DEBUG,"Deleted unused duplicate server %d (kept %d).",
- n, i );
-#endif
+ LogDebug("Deleted unused duplicate server %d (kept %d).", n, i);
}
}
} else {
/* Mark server as "once" */
Conf_Server[i].flags |= CONF_SFLAG_ONCE;
- Log( LOG_DEBUG, "Marked server %d as \"once\"", i );
+ LogDebug("Marked server %d as \"once\"", i);
}
}
}
@@ -2134,8 +2131,7 @@ Validate_Config(bool Configtest, bool Rehash)
servers_once++;
}
}
- Log(LOG_DEBUG,
- "Configuration: Operators=%ld, Servers=%d[%d], Channels=%ld",
+ LogDebug("Configuration: Operators=%ld, Servers=%d[%d], Channels=%ld",
array_length(&Conf_Opers, sizeof(struct Conf_Oper)),
servers, servers_once,
array_length(&Conf_Channels, sizeof(struct Conf_Channel)));
@@ -2236,11 +2232,11 @@ Conf_DebugDump(void)
{
int i;
- Log(LOG_DEBUG, "Configured servers:");
+ LogDebug("Configured servers:");
for (i = 0; i < MAX_SERVERS; i++) {
if (! Conf_Server[i].name[0])
continue;
- Log(LOG_DEBUG,
+ LogDebug(
" - %s: %s:%d, last=%ld, group=%d, flags=%d, conn=%d",
Conf_Server[i].name, Conf_Server[i].host,
Conf_Server[i].port, Conf_Server[i].lasttry,
diff --git a/src/ngircd/conn-func.c b/src/ngircd/conn-func.c
--- a/src/ngircd/conn-func.c +++ b/src/ngircd/conn-func.c @@ -21,11 +21,8 @@ #include#include -#ifdef DEBUG -# include "log.h" -#endif +#include "log.h" #include "conn.h" - #include "conf.h" #include "conn-func.h" @@ -116,13 +113,10 @@ Conn_SetPenalty(CONN_ID Idx, time_t Seconds) My_Connections[Idx].delaytime += Seconds; -#ifdef DEBUG - Log(LOG_DEBUG, - "Add penalty time on connection %d: %ld second%s, total %ld second%s.", + LogDebug("Add penalty time on connection %d: %ld second%s, total %ld second%s.", Idx, (long)Seconds, Seconds != 1 ? "s" : "", My_Connections[Idx].delaytime - t, My_Connections[Idx].delaytime - t != 1 ? "s" : ""); -#endif } /* Conn_SetPenalty */ GLOBAL void diff --git a/src/ngircd/conn-zip.c b/src/ngircd/conn-zip.c
--- a/src/ngircd/conn-zip.c
+++ b/src/ngircd/conn-zip.c
@@ -142,7 +142,7 @@ Zip_Flush( CONN_ID Idx )
out->avail_out = (uInt)sizeof zipbuf;
#if DEBUG_ZIP
- Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d",
+ LogDebug("out->avail_in %d, out->avail_out %d",
out->avail_in, out->avail_out);
#endif
result = deflate( out, Z_SYNC_FLUSH );
@@ -165,7 +165,7 @@ Zip_Flush( CONN_ID Idx )
zipbuf_used = WRITEBUFFER_SLINK_LEN - out->avail_out;
#if DEBUG_ZIP
- Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used);
+ LogDebug("zipbuf_used: %d", zipbuf_used);
#endif
if (!array_catb(&My_Connections[Idx].wbuf,
(char *)zipbuf, (size_t) zipbuf_used)) {
@@ -217,7 +217,7 @@ Unzip_Buffer( CONN_ID Idx )
in->avail_out = (uInt)sizeof unzipbuf;
#if DEBUG_ZIP
- Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d",
+ LogDebug("in->avail_in %d, in->avail_out %d",
in->avail_in, in->avail_out);
#endif
result = inflate( in, Z_SYNC_FLUSH );
@@ -232,7 +232,7 @@ Unzip_Buffer( CONN_ID Idx )
in_len = z_rdatalen - in->avail_in;
unzipbuf_used = READBUFFER_LEN - in->avail_out;
#if DEBUG_ZIP
- Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN,
+ LogDebug("unzipbuf_used: %d - %d = %d", READBUFFER_LEN,
in->avail_out, unzipbuf_used);
#endif
assert(unzipbuf_used <= READBUFFER_LEN);
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -875,7 +875,7 @@ va_dcl
#ifdef SNIFFER
if (NGIRCd_Sniffer)
- Log(LOG_DEBUG, " -> connection %d: '%s'.", Idx, buffer);
+ LogDebug("-> connection %d: '%s'.", Idx, buffer);
#endif
len = strlcat( buffer, "\r\n", sizeof( buffer ));
@@ -2698,11 +2698,11 @@ Conn_DebugDump(void)
{
int i;
- Log(LOG_DEBUG, "Connection status:");
+ LogDebug("Connection status:");
for (i = 0; i < Pool_Size; i++) {
if (My_Connections[i].sock == NONE)
continue;
- Log(LOG_DEBUG,
+ LogDebug(
" - %d: host=%s, lastdata=%ld, lastping=%ld, delaytime=%ld, flag=%d, options=%d, bps=%d, client=%s",
My_Connections[i].sock, My_Connections[i].host,
My_Connections[i].lastdata, My_Connections[i].lastping,
diff --git a/src/ngircd/io.c b/src/ngircd/io.c
--- a/src/ngircd/io.c
+++ b/src/ngircd/io.c
@@ -148,7 +148,7 @@ static void io_docallback PARAMS((int fd, short what));
static void
io_debug(const char *s, int fd, int what)
{
- Log(LOG_DEBUG, "%s: %d, %d\n", s, fd, what);
+ LogDebug("%s: %d, %d\n", s, fd, what);
}
#else
static inline void
diff --git a/src/ngircd/irc-login.c b/src/ngircd/irc-login.c
--- a/src/ngircd/irc-login.c
+++ b/src/ngircd/irc-login.c
@@ -774,7 +774,7 @@ IRC_PING(CLIENT *Client, REQUEST *Req)
return IRC_WriteErrClient(Client, ERR_NOSUCHSERVER_MSG,
Client_ID(Client), Req->prefix);
- Log(LOG_DEBUG, "Connection %d: got PING, sending PONG ...",
+ LogDebug("Connection %d: got PING, sending PONG ...",
Client_Conn(Client));
#ifdef STRICT_RFC
@@ -877,9 +877,7 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
(long)(time(NULL) - Conn_GetSignon(conn)),
time(NULL) - Conn_GetSignon(conn) == 1 ? "" : "s",
Client_UserCount(), Channel_CountVisible(NULL));
- }
-#ifdef DEBUG
- else {
+ } else {
if (Conn_LastPing(conn) > 1)
LogDebug("Connection %d: received PONG. Lag: %ld seconds.",
conn, (long)(time(NULL) - Conn_LastPing(conn)));
@@ -887,7 +885,6 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
LogDebug("Got unexpected PONG on connection %d. Ignored.",
conn);
}
-#endif
/* We got a PONG, so signal that none is pending on this connection. */
Conn_UpdatePing(conn, 1);
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -281,7 +281,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
break;
default:
if (Client_Type(Client) != CLIENT_SERVER) {
- Log(LOG_DEBUG,
+ LogDebug(
"Unknown mode \"%c%c\" from \"%s\"!?",
set ? '+' : '-', *mode_ptr,
Client_ID(Origin));
@@ -292,7 +292,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
*mode_ptr);
x[0] = '\0';
} else {
- Log(LOG_DEBUG,
+ LogDebug(
"Handling unknown mode \"%c%c\" from \"%s\" for \"%s\" ...",
set ? '+' : '-', *mode_ptr,
Client_ID(Origin), Client_ID(Target));
@@ -823,7 +823,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
break;
default:
if (Client_Type(Client) != CLIENT_SERVER) {
- Log(LOG_DEBUG,
+ LogDebug(
"Unknown mode \"%c%c\" from \"%s\" on %s!?",
set ? '+' : '-', *mode_ptr,
Client_ID(Origin), Channel_Name(Channel));
@@ -833,7 +833,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
Channel_Name(Channel));
x[0] = '\0';
} else {
- Log(LOG_DEBUG,
+ LogDebug(
"Handling unknown mode \"%c%c\" from \"%s\" on %s ...",
set ? '+' : '-', *mode_ptr,
Client_ID(Origin), Channel_Name(Channel));
diff --git a/src/ngircd/irc-server.c b/src/ngircd/irc-server.c
--- a/src/ngircd/irc-server.c
+++ b/src/ngircd/irc-server.c
@@ -298,7 +298,7 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req )
"Failed to join client \"%s\" to channel \"%s\" (NJOIN): killing it!",
ptr, channame);
IRC_KillClient(NULL, NULL, ptr, "Internal NJOIN error!");
- Log(LOG_DEBUG, "... done.");
+ LogDebug("... done.");
goto skip_njoin;
}
diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c
--- a/src/ngircd/ngircd.c
+++ b/src/ngircd/ngircd.c
@@ -490,9 +490,7 @@ Pidfile_Delete( void )
/* Pidfile configured? */
if( ! Conf_PidFile[0] ) return;
-#ifdef DEBUG
- Log( LOG_DEBUG, "Removing PID file (%s) ...", Conf_PidFile );
-#endif
+ LogDebug( "Removing PID file (%s) ...", Conf_PidFile );
if( unlink( Conf_PidFile ))
Log( LOG_ERR, "Error unlinking PID file (%s): %s", Conf_PidFile, strerror( errno ));
@@ -514,9 +512,7 @@ Pidfile_Create(pid_t pid)
/* Pidfile configured? */
if( ! Conf_PidFile[0] ) return;
-#ifdef DEBUG
- Log( LOG_DEBUG, "Creating PID file (%s) ...", Conf_PidFile );
-#endif
+ LogDebug( "Creating PID file (%s) ...", Conf_PidFile );
pidfd = open( Conf_PidFile, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
if ( pidfd < 0 ) {
@@ -817,7 +813,7 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
if (pwd) {
if (chdir(pwd->pw_dir) == 0)
- Log(LOG_DEBUG,
+ LogDebug(
"Changed working directory to \"%s\" ...",
pwd->pw_dir);
else
diff --git a/src/ngircd/parse.c b/src/ngircd/parse.c
--- a/src/ngircd/parse.c +++ b/src/ngircd/parse.c @@ -183,7 +183,7 @@ Parse_Request( CONN_ID Idx, char *Request ) assert( Request != NULL ); #ifdef SNIFFER - if( NGIRCd_Sniffer ) Log( LOG_DEBUG, " <- connection %d: '%s'.", Idx, Request ); + if( NGIRCd_Sniffer ) LogDebug( " <- connection %d: '%s'.", Idx, Request ); #endif Init_Request( &req ); diff --git a/src/ngircd/sighandlers.c b/src/ngircd/sighandlers.c
--- a/src/ngircd/sighandlers.c
+++ b/src/ngircd/sighandlers.c
@@ -46,17 +46,17 @@ static const int signals_catch[] = {
static void
Dump_State(void)
{
- Log(LOG_DEBUG, "--- Internal server state: %s ---",
+ LogDebug("--- Internal server state: %s ---",
Client_ID(Client_ThisServer()));
#ifdef HAVE_LONG_LONG
- Log(LOG_DEBUG, "time()=%llu", (unsigned long long)time(NULL));
+ LogDebug("time()=%llu", (unsigned long long)time(NULL));
#else
- Log(LOG_DEBUG, "time()=%lu", (unsigned long)time(NULL));
+ LogDebug("time()=%lu", (unsigned long)time(NULL));
#endif
Conf_DebugDump();
Conn_DebugDump();
Client_DebugDump();
- Log(LOG_DEBUG, "--- End of state dump ---");
+ LogDebug("--- End of state dump ---");
} /* Dump_State */
#endif
@@ -235,7 +235,7 @@ Signal_Handler_BH(int Signal)
}
break;
default:
- Log(LOG_DEBUG, "Got signal %d! Ignored.", Signal);
+ LogDebug("Got signal %d! Ignored.", Signal);
#endif
}
Signal_Unblock(Signal);
-----END OF PAGE-----