aboutsummaryrefslogtreecommitdiff
path: root/src/irc.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-04-02 02:15:52 -0400
committerB. Watson <urchlay@slackware.uk>2026-04-02 02:16:02 -0400
commit63a7c424ac966f3b824b8bdfcb756f68052533a5 (patch)
treee4b7141afc6b15f37b1009f14d66c95ebc6d3759 /src/irc.c
parent6ec38e77d7b0adb64e37e9faa82624cda2576335 (diff)
downloadfujinet-chat-63a7c424ac966f3b824b8bdfcb756f68052533a5.tar.gz
irc.c: make some locals static, deduplicate some code. 5731 bytes free.
Diffstat (limited to 'src/irc.c')
-rw-r--r--src/irc.c19
1 files changed, 10 insertions, 9 deletions
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