From 9bec26cc386043de06e30a9902158440430e7ca1 Mon Sep 17 00:00:00 2001 From: Valery V Yatsko Date: Wed, 25 Jun 2008 07:13:58 +0400 Subject: [PATCH] Merged find_orphaned_cflags and construct_noparam_modes in one function as there's no reason to use them separetly --- src/chmode.c | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/src/chmode.c b/src/chmode.c index 4f557ee46..b6ece72cb 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -66,36 +66,12 @@ static int mode_limit_simple; static int mask_pos; int chmode_flags[256]; -void -find_orphaned_cflags(void) -{ - int i; - static int prev_chmode_flags[256]; - - for (i = 0; i < 256; i++) - { - if (prev_chmode_flags[i] != 0 && prev_chmode_flags[i] != chmode_flags[i]) - { - if (chmode_flags[i] == 0) - { - chmode_table[i].set_func = chm_orphaned; - sendto_realops_snomask(SNO_DEBUG, L_ALL, "Cmode +%c is now orphaned", i); - } - else - { - sendto_realops_snomask(SNO_DEBUG, L_ALL, "Orphaned cmode +%c is picked up by module", i); - } - chmode_flags[i] = prev_chmode_flags[i]; - } - else - prev_chmode_flags[i] = chmode_flags[i]; - } -} - +/* OPTIMIZE ME! -- dwr */ void construct_noparam_modes(void) { int i; + static int prev_chmode_flags[256]; for(i = 0; i < 256; i++) { @@ -113,9 +89,23 @@ construct_noparam_modes(void) { chmode_flags[i] = 0; } + + if (prev_chmode_flags[i] != 0 && prev_chmode_flags[i] != chmode_flags[i]) + { + if (chmode_flags[i] == 0) + { + chmode_table[i].set_func = chm_orphaned; + sendto_realops_snomask(SNO_DEBUG, L_ALL, "Cmode +%c is now orphaned", i); + } + else + { + sendto_realops_snomask(SNO_DEBUG, L_ALL, "Orphaned cmode +%c is picked up by module", i); + } + chmode_flags[i] = prev_chmode_flags[i]; + } + else + prev_chmode_flags[i] = chmode_flags[i]; } - - find_orphaned_cflags(); } /*