From: Remco Rijnders Date: Sat, 7 Mar 2026 17:17:36 +0000 (-0500) Subject: CLEANUP: Fix wrong, outdated, and irrelevant comments X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=129d7855e6654b3fc8522b5a0693037ea7d6a9bd;p=serene-ircd.git CLEANUP: Fix wrong, outdated, and irrelevant comments - 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 --- diff --git a/include/config.h b/include/config.h index 0b88caa..2f838e4 100644 --- a/include/config.h +++ b/include/config.h @@ -135,8 +135,7 @@ #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 diff --git a/include/h.h b/include/h.h index ee16d0f..3c04e96 100644 --- a/include/h.h +++ b/include/h.h @@ -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 (); diff --git a/include/struct.h b/include/struct.h index 4621aff..d559ec5 100644 --- a/include/struct.h +++ b/include/struct.h @@ -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 */ /* diff --git a/src/hash.c b/src/hash.c index 7e153f6..22da10b 100644 --- a/src/hash.c +++ b/src/hash.c @@ -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)) \ diff --git a/src/ircd.c b/src/ircd.c index fc9dbf9..24fb1ce 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -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"); - exit(-1); - } - */ if (argc > 0) return bad_command (); /* This should exit out */ diff --git a/src/list.c b/src/list.c index c1219f3..0a101de 100644 --- a/src/list.c +++ b/src/list.c @@ -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; diff --git a/src/masking.c b/src/masking.c index 5972ff0..8761218 100644 --- a/src/masking.c +++ b/src/masking.c @@ -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) ; } diff --git a/src/packet.c b/src/packet.c index 5cbeebd..bd99ea3 100644 --- a/src/packet.c +++ b/src/packet.c @@ -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) diff --git a/src/parse.c b/src/parse.c index 3da86ba..883a40a 100644 --- a/src/parse.c +++ b/src/parse.c @@ -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'); diff --git a/src/s_bsd.c b/src/s_bsd.c index 7a03c7e..fa84a0b 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -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)) { diff --git a/src/s_conf.c b/src/s_conf.c index 03510fc..58ead6b 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -39,7 +39,6 @@ #include #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; diff --git a/src/s_misc.c b/src/s_misc.c index 28f01ac..f68b972 100644 --- a/src/s_misc.c +++ b/src/s_misc.c @@ -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; diff --git a/src/s_numeric.c b/src/s_numeric.c index c0a3f4f..ecaaef5 100644 --- a/src/s_numeric.c +++ b/src/s_numeric.c @@ -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; diff --git a/src/s_ping.c b/src/s_ping.c index e17d6e1..644e0fd 100644 --- a/src/s_ping.c +++ b/src/s_ping.c @@ -37,14 +37,8 @@ /* * 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) { diff --git a/src/s_serv.c b/src/s_serv.c index ada7ac6..cb44fd1 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -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)) diff --git a/src/s_user.c b/src/s_user.c index 4c348ee..ed4a2ed 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -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));