From 63a7c424ac966f3b824b8bdfcb756f68052533a5 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 2 Apr 2026 02:15:52 -0400 Subject: irc.c: make some locals static, deduplicate some code. 5731 bytes free. --- src/irc.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/irc.c') diff --git a/src/irc.c b/src/irc.c index d29c137..2fdb8b8 100644 --- a/src/irc.c +++ b/src/irc.c @@ -113,7 +113,10 @@ static void do_priv_nick(void) { will be wrong (modulo ~9 mins). I don't think it's ever going to be a real problem. Why do it this way? Because using longs instead of ints bloats the - code by 778 bytes! */ + code by 778 bytes! + note to self: using a div_t and div() seemed like it might make + the compiled code smaller, but it grew by ~50 bytes. avoid. + */ static void print_ping_time(char *p) { static unsigned int now, pingtime; static unsigned int sec, frac; @@ -305,11 +308,7 @@ static void do_part(void) { scr_print_active(msg_src); scr_print_active(" has left "); scr_print_active(msg_dest); - if(msg_text) { - scr_print_active(": "); - scr_print_active(msg_text); - } - scr_eol_active(); + print_reason(); } static void do_topic(void) { @@ -371,7 +370,7 @@ static void do_mode(void) { server will have disconnected us. */ static void permute_nick(void) { - char *last; + static char *last; last = conf->nick + strlen(conf->nick) - 1; @@ -388,7 +387,7 @@ static void permute_nick(void) { /* see: https://defs.ircdocs.horse/ */ static void do_forward_chan(void) { - char s; + static char s; if(msg_argcount > 2 && msg_args[1][0] == '#' && msg_args[2][0] == '#') { s = scr_getbyname(msg_args[1]); @@ -399,7 +398,9 @@ static void do_forward_chan(void) { } static void do_numeric(void) { - unsigned int num = atoi(msg_cmd); + static unsigned int num; + + num = atoi(msg_cmd); switch(num) { /* use the server's idea of what our nick is, in case it got -- cgit v1.2.3