]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Convert uses of Log(LOG_DEBUG, ...) to LogDebug()
authorJules Maselbas <jmaselbas@zdiv.net>
Tue, 26 Apr 2022 13:41:28 +0000 (15:41 +0200)
committerAlexander Barton <alex@barton.de>
Sat, 17 Dec 2022 13:52:44 +0000 (14:52 +0100)
14 files changed:
src/ngircd/array.c
src/ngircd/channel.c
src/ngircd/client.c
src/ngircd/conf.c
src/ngircd/conn-func.c
src/ngircd/conn-zip.c
src/ngircd/conn.c
src/ngircd/io.c
src/ngircd/irc-login.c
src/ngircd/irc-mode.c
src/ngircd/irc-server.c
src/ngircd/ngircd.c
src/ngircd/parse.c
src/ngircd/sighandlers.c

index 4cc793f18c02b3f4bea6dd1f46ed2914441740a5..6d1ab338495d05308011138a2a1afc7052c2c1ca 100644 (file)
@@ -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
index 3282a8d0460533301ca0c4f58675548fa35db833..d47b16f2c3737f9fa7462c251e1d5e5422814fb6 100644 (file)
@@ -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;
index 634cecdced292005599caa32995c0c7b1221be0a..c957ac73b029ea267edf45ac496a3e0f7684157c 100644 (file)
@@ -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),
index 140d0b9f63b9b22acb2fabb7a4065ba1ab74bae9..a748f3c4dab198bae56da136043bf804dd1ec8fd 100644 (file)
@@ -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,
index 3cf8a3a62b27d43ce32fcc1101f765dac3775fb7..25ae1b26dff830e0b457e5ffe1461d2ca70c9776 100644 (file)
 #include <assert.h>
 #include <time.h>
 
-#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
index fe7f2fb0e06ffc169aa1956065eaf30e2021c00c..36816bddecd16d341c0a241e7da67ec61e0471ff 100644 (file)
@@ -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);
index ae151b3104693e4b783361d5709e6a8d9f891878..1bd72776a2bbe015f73bc0a8ab712ea28b6ed3f5 100644 (file)
@@ -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,
index 037c4afca2af7c0cf9662058ee2a18d3a92b12eb..2a1e941e8e91b89347f4c80b86b38497a708fcd3 100644 (file)
@@ -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
index 368a03d46bef6ff775ecc029051b427d21cbef32..fb2219226d8c3654c3ebdb8029e96dd2a3ab1160 100644 (file)
@@ -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);
index 99255df14a5433f60b3ad56e35f7e8f802175916..7d3988529996c4e9811b8015b39a89fbaa7857cf 100644 (file)
@@ -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));
index 3f9753b9670d93205d5d6504e34e9f87e5984cdf..2e031bd5b37d906f16efd73ebfcc2e011d3ccadf 100644 (file)
@@ -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;
                }
 
index 8b28a2fc2de99558c18bee814d753c017c0197c1..eba853fcf98b2ad93e5fb9621df21d3ded01379d 100644 (file)
@@ -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
index 51834133bff35e8ca86cb6d2e755bc9863d8cf16..7b5d28c2dc8f87335dfd92bf18b2a06886905fe3 100644 (file)
@@ -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 );
index 8275123e6acd433a555f4e130a11faa10205ab47..cfecd5d5fc869bd240d45ee1c4111dcd0adffbd5 100644 (file)
@@ -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);