From 8dd7aec896efc0220d6234bcfb190767c30dbb29 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 24 Jun 2018 00:13:59 +0200 Subject: Change functions to static where possible (Part 1 - common) This fixes issues with plugins defining symbols with the same names Signed-off-by: Haru --- src/common/console.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/common/console.c') diff --git a/src/common/console.c b/src/common/console.c index e7edd7e1e..55a9815f5 100644 --- a/src/common/console.c +++ b/src/common/console.c @@ -53,13 +53,13 @@ # endif #endif -struct console_interface console_s; +static struct console_interface console_s; struct console_interface *console; #ifdef CONSOLE_INPUT -struct console_input_interface console_input_s; -struct spin_lock console_ptlock_s; +static struct console_input_interface console_input_s; +static struct spin_lock console_ptlock_s; -struct { +static struct { char queue[CONSOLE_PARSE_SIZE][MAX_CONSOLE_INPUT]; unsigned short count; } cinput; @@ -68,7 +68,7 @@ struct { /*====================================== * CORE : Display title *--------------------------------------*/ -void display_title(void) +static void display_title(void) { const char *vcstype = sysinfo->vcstype(); @@ -98,14 +98,14 @@ void display_title(void) /** * Shows a license notice as per GNU GPL recommendation. */ -void display_gplnotice(void) +static void display_gplnotice(void) { ShowInfo("Hercules, Copyright (C) 2012-2018, Hercules Dev Team and others.\n"); ShowInfo("Licensed under the GNU General Public License, version 3 or later.\n"); } #ifdef CONSOLE_INPUT -int console_parse_key_pressed(void) +static int console_parse_key_pressed(void) { #ifdef WIN32 return _kbhit(); @@ -131,7 +131,7 @@ int console_parse_key_pressed(void) /** * Stops server **/ -CPCMD_C(exit, server) +static CPCMD_C(exit, server) { if (core->shutdown_callback != NULL) core->shutdown_callback(); @@ -142,7 +142,7 @@ CPCMD_C(exit, server) /** * Displays ERS-related statistics (Entry Reusage System) **/ -CPCMD_C(ers_report, server) +static CPCMD_C(ers_report, server) { ers_report(); } @@ -150,7 +150,7 @@ CPCMD_C(ers_report, server) /** * Displays memory usage **/ -CPCMD_C(mem_report, server) +static CPCMD_C(mem_report, server) { #ifdef USE_MEMMGR memmgr_report(line?atoi(line):0); @@ -160,7 +160,7 @@ CPCMD_C(mem_report, server) /** * Displays command list **/ -CPCMD(help) +static CPCMD(help) { int i; for (i = 0; i < VECTOR_LENGTH(console->input->command_list); i++) { @@ -178,7 +178,7 @@ CPCMD(help) * [Ind/Hercules] * Displays current malloc usage */ -CPCMD_C(malloc_usage, server) +static CPCMD_C(malloc_usage, server) { unsigned int val = (unsigned int)iMalloc->usage(); ShowInfo("malloc_usage: %.2f MB\n",(double)(val)/1024); @@ -188,7 +188,7 @@ CPCMD_C(malloc_usage, server) * Skips an sql update * Usage: sql update skip UPDATE-FILE.sql **/ -CPCMD_C(skip, update) +static CPCMD_C(skip, update) { if( !line ) { ShowDebug("usage example: sql update skip 2013-02-14--16-15.sql\n"); @@ -200,7 +200,7 @@ CPCMD_C(skip, update) /** * Loads console commands list **/ -void console_load_defaults(void) +static void console_load_defaults(void) { /** * Defines a main category. @@ -313,7 +313,7 @@ void console_load_defaults(void) * @param name The command name. * @param func The command callback. */ -void console_parse_create(char *name, CParseFunc func) +static void console_parse_create(char *name, CParseFunc func) { int i; char *tok; @@ -370,7 +370,7 @@ void console_parse_create(char *name, CParseFunc func) * @param cmd The command entry. * @param depth The current tree depth (for display purposes). */ -void console_parse_list_subs(struct CParseEntry *cmd, unsigned char depth) +static void console_parse_list_subs(struct CParseEntry *cmd, unsigned char depth) { int i; char msg[CP_CMD_LENGTH * 2]; @@ -394,7 +394,7 @@ void console_parse_list_subs(struct CParseEntry *cmd, unsigned char depth) * * @param line The input line. */ -void console_parse_sub(char *line) +static void console_parse_sub(char *line) { struct CParseEntry *cmd; char bline[200]; @@ -457,7 +457,7 @@ void console_parse_sub(char *line) ShowError("Is only a category, type '"CL_WHITE"%s help"CL_RESET"' to list its subcommands\n",sublist); } -void console_parse(char *line) +static void console_parse(char *line) { int c, i = 0, len = MAX_CONSOLE_INPUT - 1;/* we leave room for the \0 :P */ @@ -474,7 +474,7 @@ void console_parse(char *line) line[i++] = '\0'; } -void *cThread_main(void *x) +static void *cThread_main(void *x) { while( console->input->ptstate ) {/* loopx */ if( console->input->key_pressed() ) { @@ -501,7 +501,7 @@ void *cThread_main(void *x) return NULL; } -int console_parse_timer(int tid, int64 tick, int id, intptr_t data) +static int console_parse_timer(int tid, int64 tick, int id, intptr_t data) { int i; EnterSpinLock(console->input->ptlock); @@ -514,7 +514,7 @@ int console_parse_timer(int tid, int64 tick, int id, intptr_t data) return 0; } -void console_parse_final(void) +static void console_parse_final(void) { if( console->input->ptstate ) { InterlockedDecrement(&console->input->ptstate); @@ -528,7 +528,7 @@ void console_parse_final(void) } } -void console_parse_init(void) +static void console_parse_init(void) { cinput.count = 0; @@ -548,13 +548,13 @@ void console_parse_init(void) timer->add_interval(timer->gettick() + 1000, console->input->parse_timer, 0, 0, 500);/* start listening in 1s; re-try every 0.5s */ } -void console_setSQL(struct Sql *SQL_handle) +static void console_setSQL(struct Sql *SQL_handle) { console->input->SQL = SQL_handle; } #endif /* CONSOLE_INPUT */ -void console_init(void) +static void console_init(void) { #ifdef CONSOLE_INPUT VECTOR_INIT(console->input->command_list); @@ -564,7 +564,7 @@ void console_init(void) #endif } -void console_final(void) +static void console_final(void) { #ifdef CONSOLE_INPUT console->input->parse_final(); -- cgit v1.2.3-60-g2f50