From ab31d2b07eb1349f3cba1172128c00d395f50fcc Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 08:52:32 -0500 Subject: [PATCH] Send YES/NO to Davy Jones's Locker. --- bandb/bantool.c | 58 +++++++++++++++++++++++----------------------- include/common.h | 13 ----------- include/s_conf.h | 4 ++-- ircd/ircd.c | 6 ++--- ircd/s_conf.c | 12 +++++----- ircd/s_newconf.c | 2 +- modules/m_rehash.c | 2 +- 7 files changed, 42 insertions(+), 55 deletions(-) diff --git a/bandb/bantool.c b/bandb/bantool.c index 4cd53bd7..a3af93cc 100644 --- a/bandb/bantool.c +++ b/bandb/bantool.c @@ -93,16 +93,16 @@ struct counter /* flags set by command line options */ struct flags { - int none; - int export; - int import; - int verify; - int vacuum; - int pretend; - int verbose; - int wipe; - int dupes_ok; -} flag = {YES, NO, NO, NO, NO, NO, NO, NO, NO}; + bool none; + bool export; + bool import; + bool verify; + bool vacuum; + bool pretend; + bool verbose; + bool wipe; + bool dupes_ok; +} flag = {true, false, false, false, false, false, false, false, false}; /* *INDENT-ON* */ static int table_has_rows(const char *table); @@ -145,32 +145,32 @@ main(int argc, char *argv[]) print_help(EXIT_SUCCESS); break; case 'i': - flag.none = NO; - flag.import = YES; + flag.none = false; + flag.import = true; break; case 'e': - flag.none = NO; - flag.export = YES; + flag.none = false; + flag.export = true; break; case 'u': - flag.none = NO; - flag.verify = YES; + flag.none = false; + flag.verify = true; break; case 's': - flag.none = NO; - flag.vacuum = YES; + flag.none = false; + flag.vacuum = true; break; case 'p': - flag.pretend = YES; + flag.pretend = true; break; case 'v': - flag.verbose = YES; + flag.verbose = true; break; case 'w': - flag.wipe = YES; + flag.wipe = true; break; case 'd': - flag.dupes_ok = YES; + flag.dupes_ok = true; break; default: /* '?' */ print_help(EXIT_FAILURE); @@ -200,7 +200,7 @@ main(int argc, char *argv[]) fprintf(stdout, "* charybdis bantool v.%s\n", BT_VERSION); - if(flag.pretend == NO) + if(flag.pretend == false) { if(rsdb_init(db_error_cb) == -1) { @@ -214,7 +214,7 @@ main(int argc, char *argv[]) if(flag.import && flag.wipe) { - flag.dupes_ok = YES; /* dont check for dupes if we are wiping the db clean */ + flag.dupes_ok = true; /* dont check for dupes if we are wiping the db clean */ for(i = 0; i < 3; i++) fprintf(stdout, "* WARNING: YOU ARE ABOUT TO WIPE YOUR DATABASE!\n"); @@ -226,7 +226,7 @@ main(int argc, char *argv[]) wipe_schema(); } } - if(flag.verbose && flag.dupes_ok == YES) + if(flag.verbose && flag.dupes_ok == true) fprintf(stdout, "* Allowing duplicate bans...\n"); /* checking for our files to import or export */ @@ -235,7 +235,7 @@ main(int argc, char *argv[]) snprintf(conf, sizeof(conf), "%s/%s.conf%s", etc, bandb_table[i], bandb_suffix[i]); - if(flag.import && flag.pretend == NO) + if(flag.import && flag.pretend == false) rsdb_transaction(RSDB_TRANS_START); if(flag.import) @@ -244,7 +244,7 @@ main(int argc, char *argv[]) if(flag.export) export_config(conf, i); - if(flag.import && flag.pretend == NO) + if(flag.import && flag.pretend == false) rsdb_transaction(RSDB_TRANS_END); } @@ -497,9 +497,9 @@ import_config(const char *conf, int id) else snprintf(newreason, sizeof(newreason), "%s", f_reason); - if(flag.pretend == NO) + if(flag.pretend == false) { - if(flag.dupes_ok == NO) + if(flag.dupes_ok == false) drop_dupes(f_mask1, f_mask2, bandb_table[id]); rsdb_exec(NULL, diff --git a/include/common.h b/include/common.h index e674e100..7754007e 100644 --- a/include/common.h +++ b/include/common.h @@ -31,19 +31,6 @@ #endif -/* Blah. I use these a lot. -Dianora */ -#ifdef YES -#undef YES -#endif - -#define YES 1 - -#ifdef NO -#undef NO -#endif - -#define NO 0 - /* Just blindly define our own MIN/MAX macro */ #define IRCD_MAX(a, b) ((a) > (b) ? (a) : (b)) diff --git a/include/s_conf.h b/include/s_conf.h index 49c713f4..49a0d1e8 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -373,8 +373,8 @@ extern void add_temp_dline(struct ConfItem *); extern void report_temp_klines(struct Client *); extern void show_temp_klines(struct Client *, rb_dlink_list *); -extern int rehash(int); -extern void rehash_bans(int); +extern bool rehash(bool); +extern void rehash_bans(void); extern int conf_add_server(struct ConfItem *, int); extern void conf_add_class_to_conf(struct ConfItem *); diff --git a/ircd/ircd.c b/ircd/ircd.c index f4d3d535..1bd94f2e 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -290,13 +290,13 @@ check_rehash(void *unused) */ if(dorehash) { - rehash(1); + rehash(true); dorehash = false; } if(dorehashbans) { - rehash_bans(1); + rehash_bans(); dorehashbans = false; } @@ -696,7 +696,7 @@ charybdis_main(int argc, char *argv[]) init_bandb(); init_ssld(); - rehash_bans(0); + rehash_bans(); initialize_server_capabs(); /* Set up default_server_capabs */ initialize_global_set_options(); diff --git a/ircd/s_conf.c b/ircd/s_conf.c index ae7675e4..ef5966c0 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -636,10 +636,10 @@ attach_conf(struct Client *client_p, struct ConfItem *aconf) * as a result of an operator issuing this command, else assume it has been * called as a result of the server receiving a HUP signal. */ -int -rehash(int sig) +bool +rehash(bool sig) { - if(sig != 0) + if(sig) { sendto_realops_snomask(SNO_GENERAL, L_ALL, "Got signal SIGHUP, reloading ircd conf. file"); @@ -647,7 +647,7 @@ rehash(int sig) rehash_authd(); /* don't close listeners until we know we can go ahead with the rehash */ - read_conf_files(NO); + read_conf_files(false); if(ServerInfo.description != NULL) rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info)); @@ -655,11 +655,11 @@ rehash(int sig) rb_strlcpy(me.info, "unknown", sizeof(me.info)); open_logfiles(); - return (0); + return false; } void -rehash_bans(int sig) +rehash_bans(void) { bandb_rehash_bans(); } diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c index b7a9768c..4b79f291 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.c @@ -196,7 +196,7 @@ find_shared_conf(const char *username, const char *host, } } - return NO; + return false; } void diff --git a/modules/m_rehash.c b/modules/m_rehash.c index e2563750..4fc41161 100644 --- a/modules/m_rehash.c +++ b/modules/m_rehash.c @@ -73,7 +73,7 @@ rehash_bans_loc(struct Client *source_p) if (!MyConnect(source_p)) remote_rehash_oper_p = source_p; - rehash_bans(0); + rehash_bans(); } static void