CLEANUP: Fix wrong, outdated, and irrelevant comments
authorRemco Rijnders <remmy@serenity-irc.net>
Sat, 7 Mar 2026 17:17:36 +0000 (12:17 -0500)
committerRemco Rijnders <remmy@serenity-irc.net>
Sat, 7 Mar 2026 17:17:36 +0000 (12:17 -0500)
- Remove leftover debug printf() calls in masking.c (one with
  typo /n instead of \n)
- Remove commented-out code: FLAGS_SJOIN, FLAGS_SNICK, UMODE_WEBTV,
  hidden[] struct fields, aJinxItem, old initconf(), pv[4] declarations,
  debuglevel block in ircd.c, fixme/commented code in s_serv.c
- Remove unused #define debug 1 in s_conf.c
- Fix outdated comments: TSpre7 reference in s_numeric.c, DreamForge
  reference in s_ping.c, "KLUDGE to get it work" in s_bsd.c,
  "This used to be the case. Now it no longer is." in s_bsd.c,
  "Impact? Let's see..." in list.c, "Yuck. Stuck." in packet.c
- Replace misleading comments with accurate descriptions
- Add clarifying comments: hash table compare macro, IRC numeric
  parsing, fd remapping on close, server DNS verification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16 files changed:
include/config.h
include/h.h
include/struct.h
src/hash.c
src/ircd.c
src/list.c
src/masking.c
src/packet.c
src/parse.c
src/s_bsd.c
src/s_conf.c
src/s_misc.c
src/s_numeric.c
src/s_ping.c
src/s_serv.c
src/s_user.c

index 0b88caa8dbbec9a58f4dc6b61df6afc55b222318..2f838e4b68b7fa4321b7b07114537f2957671ca3 100644 (file)
 #undef COMMENT_IS_FILE
 
 
-/* #undef      DEBUGMODE       *//* define DEBUGMODE to enable debugging mode.*/
-//#define DEBUGMODE
+/* #undef DEBUGMODE */  /* define DEBUGMODE to enable debugging mode */
 
 /*
  * Defining FORCE_CORE will automatically "unlimit core", forcing the
index ee16d0f30d6dda09dd5675d3861bf38c77856f01..3c04e96f632526d62846229c33f1423500ecde19 100644 (file)
@@ -98,9 +98,7 @@ extern  int     find_socksexception (aClient *);
 extern  int     find_dccblock (char *);
 extern int     find_restrict (aClient *);
 extern int     rehash (aClient *, aClient *, int);
-// fixme: this is used 2 diffrent ways depending on the file ?
 extern int     initconf (int);
-// extern  aConfItem *initconf();
 extern void    add_temp_conf();
 extern void    inittoken ();
 extern  int     do_channel_synch(char *);
@@ -232,7 +230,6 @@ extern      Link    *make_link ();
 extern Ban     *make_ban ();
 extern anUser  *make_user (aClient *);
 extern  aSqlineItem *make_sqline ();
-//extern  aJinxItem *make_jinx ();
 extern aConfItem *make_conf ();
 extern aClass  *make_class ();
 extern aServer *make_server ();
index 4621aff364f4e674f3b9fdef5b568d9fc0d49b00..d559ec56d0bb8754d9d58ac17a941c0d20915a8a 100644 (file)
@@ -173,10 +173,8 @@ typedef struct  Zdata   aZdata;
 #define FLAGS_PING     0x80000         /* UPING SENT */
 #define FLAGS_ASKEDPING 0x100000       /* UPONG GOT*/
 
-//#define FLAGS_SJOIN   0x1000000 /* have SJOIN */
 #define FLAGS_MAP     0x2000000 /* Show this entry in /map */
 #define FLAGS_JOINING 0x4000000 /* Prevent user from getting killed during JOIN */
-//#define FLAGS_SNICK   0x8000000 /* have SNICK */
 
 /* Need more flags - here's flags2 */
 
@@ -189,7 +187,6 @@ typedef struct  Zdata   aZdata;
 
 #define        UMODE_INVISIBLE  0x0001 /* makes user invisible */
 #define        UMODE_OPER       0x0002 /* Operator */
-//#define UMODE_WEBTV      0x0004 /* WebTV user */
 #define UMODE_FAILOP     0x0008 /* Shows some global messages */
 /* mode 0x0010 available */
 #define UMODE_REGMSGONLY 0x0020 /* Only registered users may message */
@@ -536,7 +533,6 @@ struct      User    {
        char    host[HOSTLEN+1];
        char    mask[HOSTLEN+1];
         char   server[HOSTLEN+1];
-//        char    hidden[5];      /* Used for /whowas masking -GZ */
                                /*
                                ** In a perfect world the 'server' name
                                ** should not be needed, a pointer to the
@@ -619,7 +615,6 @@ struct Client       {
        char    version[REALLEN+1]; /* version of the client (servers only) -GZ */
         int     jinx;           /* Tag for jinx */
        int     cc;             /* Cline client-check for connect -GZ */
-//        char    hidden[5];       /* Used for /whowas masking -GZ */
        aClient *srvptr;        /* Server introducing this.  May be &me */
        Link    *history;       /* Whowas linked list */
        /*
index 7e153f6a827a964688f0b9eb94fc5a6597a35d20..22da10b9c04eafe92e8af2aae7852ee4e77b3b5a 100644 (file)
@@ -26,7 +26,7 @@
 #include "h.h"
 
 
-/* Quick & dirty inline version of mycmp for hash-tables -Donwulff */
+/* Case-insensitive string compare; jumps to label 'where' on match */
 #define thecmp(str1, str2, where) { \
                                     char *st1=str1, *st2=str2; \
                                     while (tolower(*st1)==tolower(*st2)) \
index fc9dbf9d53206256e2f68b3a24f1aafbf660c345..24fb1ce618671474b49b6e55a0695467e2b5af09 100644 (file)
@@ -567,15 +567,6 @@ int main (int argc, char *argv[])
     }
 #endif /*CHROOTDIR/UID/GID */
 
-    /* didn't set debuglevel */
-    /* but asked for debugging output to tty */
-    /*
-       if ((debuglevel < 0) && (bootopt & BOOT_TTY)) {
-       (void) fprintf(stderr,
-       "you specified -t without -x. use -x <n>\n");
-       exit(-1);
-       }
-     */
     if (argc > 0)
        return bad_command ();    /* This should exit out */
 
index c1219f3d6b23bb78c5b33d6387a5f0a4aad33123..0a101de741b9838143b5ae1380819f996d69cfd6 100644 (file)
@@ -367,12 +367,10 @@ Link *make_link ()
     Link *lp;
     int i;
 
-    /* "caching" slab-allocator... ie. we're allocating one pages
-       (hopefully - upped to the Linux default, not dbuf.c) worth of 
-       link-structures at time to avoid all the malloc overhead.
-       All links left free from this process or separately freed 
-       by a call to free_link() are moved over to freelink-list.
-       Impact? Let's see... -Donwulff */
+    /* Slab allocator: allocate LINKSIZE Link structs at once to
+     * reduce malloc overhead. Freed links go to the freelink list
+     * for reuse.
+     */
     if (freelink == NULL) {
        lp = (Link *) MyMalloc (LINKSIZE * sizeof (Link));
        freelink = lp + 1;
index 5972ff0334aba157502ae958f5af0fbb54a0c2e6..87612188d8cd4511eb607f349aaf2831904f296a 100644 (file)
@@ -29,7 +29,6 @@ void calc_mask(aClient *acptr)
 #endif
 
   strncpy(acptr->user->mask, return_user_mask(acptr->user->host), HOSTLEN +1) ;
-  printf("check: %s \n",return_user_mask(acptr->user->host) );  
 #endif /* CLIENT_MASKING */   
 }
 
@@ -102,7 +101,6 @@ char *Maskchecksum(char *data, char *salt)
   char static tmp[HOSTLEN + 1] ;
   
   strncpy(tmp,crypt(data, salt),HOSTLEN) ;
-  printf("%s/n",tmp) ;           
   return (tmp) ;
 }
 
index 5cbeebd5b88cdabce9c392bd38ffc2736cbc579a..bd99ea3ba38f3c3164b310f6596f30e8035634c9 100644 (file)
@@ -119,12 +119,9 @@ int dopacket (aClient *cptr, char *buffer, int length)
 
     while (--length >= 0 && ch2) {
        char g = (*ch1 = *ch2++);
-       /*
-        * Yuck.  Stuck.  To make sure we stay backward compatible,
-        * we must assume that either CR or LF terminates the message
-        * and not CR-LF.  By allowing CR or LF (alone) into the body
-        * of messages, backward compatibility is lost and major
-        * problems will arise. - Avalon
+       /* Either CR or LF alone terminates a message, not just
+        * CR-LF. Allowing bare CR or LF in message bodies would
+        * break compatibility with older implementations.
         */
        if (g < '\16' && (g == '\n' || g == '\r')) {
            if (ch1 == cptr->buffer)
index 3da86ba5c74b2a2dae283f435486b6bf0fcd49e9..883a40a788ad50ef41ec757e7227f3e83b967da7 100644 (file)
@@ -236,6 +236,7 @@ int parse (aClient *cptr, char *buffer, char *bufend, struct Message *mptr)
     len = (s) ? (s - ch) : 0;
     if (len == 3 && isdigit (*ch) && isdigit (*(ch + 1))
        && isdigit (*(ch + 2))) {
+       /* IRC numeric reply: exactly 3 decimal digits */
        mptr = NULL;
        numeric =
            (*ch - '0') * 100 + (*(ch + 1) - '0') * 10 + (*(ch + 2) - '0');
index 7a03c7e53415161b564b5b41222f7cfb82f0b375..fa84a0bd63b9794b08b27856ac3e30e596058f4c 100644 (file)
@@ -202,12 +202,6 @@ int inetport (aClient *cptr, char *name, int port)
        server.sin_addr.s_addr = inet_addr (ipname);
        server.sin_port = htons (port);
        /*
-        * Try 10 times to bind the socket with an interval of 20
-        * seconds. Do this so we dont have to keepp trying manually
-        * to bind. Why ? Because a port that has closed often lingers
-        * around for a short time.
-        * This used to be the case.  Now it no longer is.
-        * Could cause the server to hang for too long - avalon
         */
        if (bind (cptr->fd, (struct sockaddr *) &server, sizeof (server)) ==
            -1) {
@@ -221,7 +215,7 @@ int inetport (aClient *cptr, char *name, int port)
        (void) close (cptr->fd);
        return -1;
     }
-    if (cptr == &me) {           /* KLUDGE to get it work... */
+    if (cptr == &me) {           /* Report port to stdout during startup */
        char buf[1024];
 
        (void) sprintf (buf, rpl_str (RPL_MYPORTIS), me.name, "*",
@@ -559,6 +553,10 @@ int check_server (aClient *cptr, struct hostent *hp, aConfItem *c_conf, aConfIte
        return -2;
 
   check_serverback:
+    /* Verify connecting server's IP matches DNS, then search for
+     * matching C/N lines. If hp is NULL but hostp exists, retry
+     * with the resolver's cached result.
+     */
     if (hp) {
        for (i = 0; hp->h_addr_list[i]; i++)
            if (!memcmp (hp->h_addr_list[i], (char *) &cptr->ip, sizeof (struct in_addr)))
@@ -808,10 +806,11 @@ void close_connection (aClient *cptr)
            break;
 
     det_confs_butmask (cptr, 0);
-    cptr->from = NULL;           /* ...this should catch them! >:) --msa */
+    cptr->from = NULL;
 
     /*
-     * fd remap to keep local[i] filled at the bottom.
+     * Move highest fd down to fill the gap left by the closed
+     * connection, keeping the local[] array compact. Skip log fds.
      */
     if (empty > 0)
        if ((j = highest_fd) > (i = empty) && (local[j]->status != STAT_LOG)) {
index 03510fc9e22d794b640e788b324d9187811e2d93..58ead6bb260bdd44d08a53a29847aa1f0d4ce8bc 100644 (file)
@@ -39,7 +39,6 @@
 #include <arpa/inet.h>
 
 #include "h.h"
-#define debug 1
 static int lookup_confhost (aConfItem *);
 static int advanced_check (char *, int);
 int ZLineExists (char *);
@@ -996,13 +995,8 @@ int initconf (int opt)
        if (IsIllegal (aconf))
            continue;
 
-       for (;;) {                /* Fake loop, that I can use break here --msa */
-           /* Yes I know this could be much cleaner, but I did not
-            * want to put it into its own separate function, but  
-            * I believe the X:should be like this:
-            * X:restartpass:diepass
-            * which leaves this code untouched. This is already indented
-            * enough to justify that...
+       for (;;) {                /* Parse remaining fields; break on missing field */
+           /* X: line format is X:restartpass:diepass
             */
            if ((tmp = getfield (NULL)) == NULL)
                break;
index 28f01acf4ad9223ce7638b36e6081fcc046d8721..f68b9729872ea49feeb54dbfaff9b8f5376dc590 100644 (file)
@@ -536,11 +536,7 @@ static void exit_one_client_backend (aClient *cptr, aClient *sptr, aClient *from
        return;                   /* ...must *never* exit self!! */
     }
     else if (IsServer (sptr)) {
-       /*
-          ** Old sendto_serv_but_one() call removed because we now
-          ** need to send different names to different servers
-          ** (domain name matching)
-        */
+       /* Propagate SQUIT to each server link individually */
        for (i = 0; i <= highest_fd; i++) {
            aConfItem *aconf;
 
index c0a3f4fa67259d4332fba0b3d452314f6f626472..ecaaef5a9df45982280a643ba49afcc0520ff733 100644 (file)
@@ -88,12 +88,8 @@ int do_numeric (int numeric, aClient *cptr, aClient *sptr, int parc, char *parv[
               ** - Avalon
             */
            if (!IsMe (acptr) && IsPerson (acptr)) {
-               /* Added for .U3.2. drop remote 'You are not on
-                  ** that channel', we should be synced anyway,
-                  ** and this is an annoying message with TSpre7
-                  ** still on the net; would result in numeric 442 for
-                  ** every KICK... Can be removed when TSpre7 is gone.
-                  ** --Run
+               /* Drop remote ERR_NOTONCHANNEL to avoid spurious
+                * 442 numerics during KICK propagation.
                 */
                if (numeric == ERR_NOTONCHANNEL)
                    return 0;
index e17d6e1ecc3c89299805652fd3003a69b47afc3f..644e0fd92b401edbf019a11f7165c9d9891dfc61 100644 (file)
 /*
  * sendto_one_notice
  *
- *      sendto_one_notice should be used for all NOTICEs that might be
- *      addressed to a remote user, *and* are from this server
- *
- *  *** MAKE ME LOOK MORE PRETTY:
- *  This really should not be here, but I'm too lazy to go change all
- *  the notice calls below. Seeing as s_uping.c is the only place from
- *  which it's called, and because it should really be removed, I've
- *  put it here; instead of in send.c -TheShadow
+ * Sends a NOTICE to a client, prefixing with "NOTICE nick :".
+ * Used by the UPING subsystem.
  */
 void sendto_one_notice (aClient *to, char *pattern, ...)
 {
@@ -156,7 +150,6 @@ void send_ping (aClient *cptr)
        if (cptr->acpt)
            sendto_one_notice (cptr->acpt, "UPING: sendto() failed: %s",
                               strerror (get_sockerr (cptr)));
-//    Debug((DEBUG_SEND, "send_ping: sendto failed on %d (%d)", cptr->fd, err));
        (void) end_ping (cptr);
     }
     else if (--(cptr->count) <= 0) {
index ada7ac6a2c3672f4195c3e47bdadf7bef9f127b8..cb44fd1d826dd69af93f8667a312ff11d8fefb52 100644 (file)
@@ -1946,7 +1946,6 @@ int m_connect (aClient *cptr, aClient *sptr, int parc, char *parv[])
 int m_gnotice (aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
     char *message;
-/*  char *pv[4]; Compiler says this is not used */
 
     if (check_registered (sptr))
        return 0;
@@ -1976,7 +1975,6 @@ int m_gnotice (aClient *cptr, aClient *sptr, int parc, char *parv[])
 int m_globops (aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
     char *message;
-/*  char    *pv[4]; Compiler says this is not used */
 
     if (check_registered (sptr))
        return 0;
@@ -2007,7 +2005,6 @@ int m_globops (aClient *cptr, aClient *sptr, int parc, char *parv[])
 int m_locops (aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
     char *message;
-/*  char    *pv[4]; Compiler says this is not used */
 
     if (check_registered_user (cptr))
        return 0;
@@ -2036,7 +2033,6 @@ int m_locops (aClient *cptr, aClient *sptr, int parc, char *parv[])
 int m_goper (aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
     char *message;
-/*  char *pv[4]; Compiler says this is not used */
 
     if (check_registered (sptr))
        return 0;
@@ -2975,8 +2971,6 @@ int do_snick (aClient * cptr, aClient * sptr, int parc, char *parv[])
 
     if ((aconf = find_conf_name (parv[1], CONF_QUARANTINED_NICK))
        || (asqline = find_sqline_match (parv[1]))) {
-// fixme
-//              char *qrsn = (aconf) ? aconf->passwd : asqline->reason;
        char *qtyp = (aconf) ? "Q:Lined" : "SQLined";
 
        if (!find_conf_host (cptr->confs, sptr->user->server, CONF_UWORLD))
index 4c348ee1ade01920d66a462f8f381cda858e9a0f..ed4a2ed2869df97c9d83a417d15393adca19fef4 100644 (file)
@@ -2179,7 +2179,6 @@ int m_user (aClient *cptr, aClient *sptr, int parc, char *parv[])
                        "on non-existant server %s.", sptr->name, server);
        strncpyzt (user->server, server, sizeof (user->server));
        strncpyzt (user->host, host, sizeof (user->host));
-       //strncpyzt(user->hidden, hidden, sizeof(user->hidden));
        goto user_finish; }
     else {
         strncpyzt(sptr->sup_server, server, sizeof(sptr->sup_server));