From 60c044d78a059ca896a5bbab33aa9ca85168dfa3 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 15 Aug 2016 01:17:35 -0700 Subject: [PATCH] Fix redundant/conflicting namespace labels. --- include/ircd/s_conf.h | 4 +-- ircd/authproc.cc | 58 ++++++++++++++++++++++--------------------- ircd/ircd_lexer.ll | 20 +++++++++------ ircd/modules.cc | 4 +-- modules/m_help.cc | 6 ++--- 5 files changed, 49 insertions(+), 43 deletions(-) diff --git a/include/ircd/s_conf.h b/include/ircd/s_conf.h index 68b6d888c..29bfb6e29 100644 --- a/include/ircd/s_conf.h +++ b/include/ircd/s_conf.h @@ -387,9 +387,9 @@ void yyerror(const char *); } // namespace ircd inline -auto yyerror(const char *const c) +void yyerror(const char *const c) { - return ircd::yyerror(c); + ircd::yyerror(c); } #endif // __cplusplus diff --git a/ircd/authproc.cc b/ircd/authproc.cc index d7170ecdd..04448dd61 100644 --- a/ircd/authproc.cc +++ b/ircd/authproc.cc @@ -22,7 +22,7 @@ * USA */ -using namespace ircd; +namespace ircd { typedef void (*authd_cb_t)(int, char **); @@ -44,17 +44,17 @@ static void cmd_notice_client(int parc, char **parv); static void cmd_oper_warn(int parc, char **parv); static void cmd_stats_results(int parc, char **parv); -rb_helper *ircd::authd_helper; +rb_helper *authd_helper; static char *authd_path; uint32_t cid; static rb_dictionary *cid_clients; static struct ev_entry *timeout_ev; -rb_dictionary *ircd::bl_stats; +rb_dictionary *bl_stats; -rb_dlink_list ircd::opm_list; -struct OPMListener ircd::opm_listeners[LISTEN_LAST]; +rb_dlink_list opm_list; +struct OPMListener opm_listeners[LISTEN_LAST]; std::array authd_cmd_tab = []{ @@ -298,7 +298,7 @@ parse_authd_reply(rb_helper * helper) } void -ircd::init_authd(void) +init_authd(void) { if(start_authd()) { @@ -308,7 +308,7 @@ ircd::init_authd(void) } void -ircd::configure_authd(void) +configure_authd(void) { /* Timeouts */ set_authd_timeout("ident_timeout", GlobalSetOptions.ident_timeout); @@ -371,7 +371,7 @@ authd_free_client_cb(rb_dictionary_element *delem, void *unused) } void -ircd::authd_abort_client(struct Client *client_p) +authd_abort_client(struct Client *client_p) { rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(client_p->preClient->auth.cid)); authd_free_client(client_p); @@ -400,20 +400,20 @@ restart_authd_cb(rb_helper * helper) } void -ircd::restart_authd(void) +restart_authd(void) { ierror("authd restarting..."); restart_authd_cb(authd_helper); } void -ircd::rehash_authd(void) +rehash_authd(void) { rb_helper_write(authd_helper, "R"); } void -ircd::check_authd(void) +check_authd(void) { if(authd_helper == NULL) restart_authd(); @@ -443,7 +443,7 @@ generate_cid(void) * could then be processed too early by read_packet(). */ void -ircd::authd_initiate_client(struct Client *client_p, bool defer) +authd_initiate_client(struct Client *client_p, bool defer) { char client_ipaddr[HOSTIPLEN+1]; char listen_ipaddr[HOSTIPLEN+1]; @@ -528,7 +528,7 @@ authd_decide_client(struct Client *client_p, const char *ident, const char *host } void -ircd::authd_deferred_client(struct Client *client_p) +authd_deferred_client(struct Client *client_p) { client_p->preClient->auth.flags &= ~AUTHC_F_DEFERRED; if(client_p->preClient->auth.flags & AUTHC_F_COMPLETE) @@ -537,14 +537,14 @@ ircd::authd_deferred_client(struct Client *client_p) /* Convenience function to accept client */ void -ircd::authd_accept_client(struct Client *client_p, const char *ident, const char *host) +authd_accept_client(struct Client *client_p, const char *ident, const char *host) { authd_decide_client(client_p, ident, host, true, '\0', NULL, NULL); } /* Convenience function to reject client */ void -ircd::authd_reject_client(struct Client *client_p, const char *ident, const char *host, char cause, const char *data, const char *reason) +authd_reject_client(struct Client *client_p, const char *ident, const char *host, char cause, const char *data, const char *reason) { authd_decide_client(client_p, ident, host, false, cause, data, reason); } @@ -578,7 +578,7 @@ timeout_dead_authd_clients(void *notused) /* Send a new blacklist to authd */ void -ircd::add_blacklist(const char *host, const char *reason, uint8_t iptype, rb_dlink_list *filters) +add_blacklist(const char *host, const char *reason, uint8_t iptype, rb_dlink_list *filters) { rb_dlink_node *ptr; struct BlacklistStats *stats = (BlacklistStats *)rb_malloc(sizeof(struct BlacklistStats)); @@ -617,7 +617,7 @@ ircd::add_blacklist(const char *host, const char *reason, uint8_t iptype, rb_dli /* Delete a blacklist */ void -ircd::del_blacklist(const char *host) +del_blacklist(const char *host) { struct BlacklistStats *stats = (BlacklistStats *)rb_dictionary_retrieve(bl_stats, host); if(stats != NULL) @@ -641,7 +641,7 @@ blacklist_delete(rb_dictionary_element *delem, void *unused) /* Delete all the blacklists */ void -ircd::del_blacklist_all(void) +del_blacklist_all(void) { if(bl_stats != NULL) rb_dictionary_destroy(bl_stats, blacklist_delete, NULL); @@ -652,7 +652,7 @@ ircd::del_blacklist_all(void) /* Adjust an authd timeout value */ bool -ircd::set_authd_timeout(const char *key, int timeout) +set_authd_timeout(const char *key, int timeout) { if(timeout <= 0) return false; @@ -663,7 +663,7 @@ ircd::set_authd_timeout(const char *key, int timeout) /* Enable identd checks */ void -ircd::ident_check_enable(bool enabled) +ident_check_enable(bool enabled) { rb_helper_write(authd_helper, "O ident_enabled %d", enabled ? 1 : 0); } @@ -673,7 +673,7 @@ ircd::ident_check_enable(bool enabled) * configure_authd() is called. */ void -ircd::conf_create_opm_listener(const char *ip, uint16_t port) +conf_create_opm_listener(const char *ip, uint16_t port) { char ipbuf[HOSTIPLEN]; struct OPMListener *listener; @@ -692,7 +692,7 @@ ircd::conf_create_opm_listener(const char *ip, uint16_t port) } void -ircd::create_opm_listener(const char *ip, uint16_t port) +create_opm_listener(const char *ip, uint16_t port) { char ipbuf[HOSTIPLEN]; @@ -709,7 +709,7 @@ ircd::create_opm_listener(const char *ip, uint16_t port) } void -ircd::delete_opm_listener_all(void) +delete_opm_listener_all(void) { memset(&opm_listeners, 0, sizeof(opm_listeners)); rb_helper_write(authd_helper, "O opm_listener_del_all"); @@ -717,7 +717,7 @@ ircd::delete_opm_listener_all(void) /* Disable all OPM scans */ void -ircd::opm_check_enable(bool enabled) +opm_check_enable(bool enabled) { rb_helper_write(authd_helper, "O opm_enabled %d", enabled ? 1 : 0); } @@ -727,7 +727,7 @@ ircd::opm_check_enable(bool enabled) * configure_authd() is called. */ void -ircd::conf_create_opm_proxy_scanner(const char *type, uint16_t port) +conf_create_opm_proxy_scanner(const char *type, uint16_t port) { struct OPMScanner *scanner = (OPMScanner *)rb_malloc(sizeof(struct OPMScanner)); @@ -737,14 +737,14 @@ ircd::conf_create_opm_proxy_scanner(const char *type, uint16_t port) } void -ircd::create_opm_proxy_scanner(const char *type, uint16_t port) +create_opm_proxy_scanner(const char *type, uint16_t port) { conf_create_opm_proxy_scanner(type, port); rb_helper_write(authd_helper, "O opm_scanner %s %hu", type, port); } void -ircd::delete_opm_proxy_scanner(const char *type, uint16_t port) +delete_opm_proxy_scanner(const char *type, uint16_t port) { rb_dlink_node *ptr, *nptr; @@ -765,7 +765,7 @@ ircd::delete_opm_proxy_scanner(const char *type, uint16_t port) } void -ircd::delete_opm_proxy_scanner_all(void) +delete_opm_proxy_scanner_all(void) { rb_dlink_node *ptr, *nptr; @@ -779,3 +779,5 @@ ircd::delete_opm_proxy_scanner_all(void) rb_helper_write(authd_helper, "O opm_scanner_del_all"); } + +} // namespace ircd diff --git a/ircd/ircd_lexer.ll b/ircd/ircd_lexer.ll index dcf64cbb5..488236d87 100644 --- a/ircd/ircd_lexer.ll +++ b/ircd/ircd_lexer.ll @@ -26,19 +26,23 @@ #include "ircd_parser.hh" +namespace ircd +{ + char *current_file = conffilebuf; + int lineno = 1; + char conffilebuf[BUFSIZE+1]; +} + using namespace ircd; YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; int include_stack_ptr=0; -int ircd::lineno = 1; void ccomment(void); void cinclude(void); void hashcomment(void); int ieof(void); int lineno_stack[MAX_INCLUDE_DEPTH]; char conffile_stack[MAX_INCLUDE_DEPTH][BUFSIZE]; -char ircd::conffilebuf[BUFSIZE+1]; -char *ircd::current_file = ircd::conffilebuf; FILE *inc_fbfile_in[MAX_INCLUDE_DEPTH]; @@ -49,7 +53,7 @@ char yy_linebuf[16384]; #define YY_FATAL_ERROR(msg) conf_yy_fatal_error(msg) #define YY_INPUT(buf,result,max_size) \ - if (!(result = ircd::conf_fgets(buf, max_size, ircd::conf_fbfile_in))) \ + if (!(result = conf_fgets(buf, max_size, conf_fbfile_in))) \ YY_FATAL_ERROR("input in flex scanner failed"); %} @@ -195,7 +199,7 @@ void cinclude(void) lineno = 1; inc_fbfile_in[include_stack_ptr] = conf_fbfile_in; strcpy(conffile_stack[include_stack_ptr], c); - ircd::current_file = conffile_stack[include_stack_ptr]; + current_file = conffile_stack[include_stack_ptr]; include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; conf_fbfile_in = tmp_fbfile_in; yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); @@ -220,9 +224,9 @@ int ieof(void) conf_fbfile_in = inc_fbfile_in[include_stack_ptr]; if(include_stack_ptr) - ircd::current_file = conffile_stack[include_stack_ptr]; + current_file = conffile_stack[include_stack_ptr]; else - ircd::current_file = conffilebuf; + current_file = conffilebuf; yy_switch_to_buffer(include_stack[include_stack_ptr]); return 0; @@ -237,5 +241,5 @@ void hashcomment(void) return; if (!rb_strncasecmp(yytext, INCLUDE, sizeof(INCLUDE) - 1)) - ircd::yyerror("You probably meant '.include', skipping"); + ::yyerror("You probably meant '.include', skipping"); } diff --git a/ircd/modules.cc b/ircd/modules.cc index 7014821bf..8d13cd993 100644 --- a/ircd/modules.cc +++ b/ircd/modules.cc @@ -353,7 +353,7 @@ static bool init_module__cap(struct module *const mod, mapi_cap_list_av2 *const m) { - using ircd::capability::index; + using capability::index; index *idx; switch(m->cap_index) @@ -383,7 +383,7 @@ static void fini_module__cap(struct module *const mod, mapi_cap_list_av2 *const m) { - using ircd::capability::index; + using capability::index; index *idx; switch(m->cap_index) diff --git a/modules/m_help.cc b/modules/m_help.cc index 3877a3f08..5345ba7dd 100644 --- a/modules/m_help.cc +++ b/modules/m_help.cc @@ -51,7 +51,7 @@ DECLARE_MODULE_AV2(help, NULL, NULL, help_clist, NULL, NULL, NULL, NULL, help_de static void m_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - using namespace ircd::cache::help; + using namespace cache::help; dohelp(source_p, USER, parc > 1 ? parv[1] : NULL); } @@ -62,7 +62,7 @@ m_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p static void mo_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - using namespace ircd::cache::help; + using namespace cache::help; dohelp(source_p, OPER, parc > 1 ? parv[1] : NULL); } @@ -74,7 +74,7 @@ mo_help(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ static void mo_uhelp(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - using namespace ircd::cache::help; + using namespace cache::help; dohelp(source_p, USER, parc > 1 ? parv[1] : NULL); }