TS-1314: Apply static to Main.cc
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c00f951d Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c00f951d Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c00f951d Branch: refs/heads/master Commit: c00f951de8b25184200398253f2e62aeb941ec25 Parents: b21ccf7 Author: James Peach <[email protected]> Authored: Tue Jun 26 21:34:50 2012 -0700 Committer: James Peach <[email protected]> Committed: Tue Jul 10 08:47:58 2012 -0700 ---------------------------------------------------------------------- proxy/Main.cc | 65 ++++++++++++++++++++++--------------------------- proxy/signals.cc | 1 - 2 files changed, 29 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c00f951d/proxy/Main.cc ---------------------------------------------------------------------- diff --git a/proxy/Main.cc b/proxy/Main.cc index 29ccb8c..d200e52 100644 --- a/proxy/Main.cc +++ b/proxy/Main.cc @@ -117,25 +117,26 @@ extern "C" int plock(int); #define DEFAULT_REMOTE_MANAGEMENT_FLAG 0 -int version_flag = DEFAULT_VERSION_FLAG; -int stack_trace_flag = DEFAULT_STACK_TRACE_FLAG; +static void * mgmt_restart_shutdown_callback(void *, char *, int data_len); +static bool xmlBandwidthSchemaRead(XMLNode * node); -int number_of_processors = ink_number_of_processors(); -int num_of_net_threads = DEFAULT_NUMBER_OF_THREADS; +static int version_flag = DEFAULT_VERSION_FLAG; + +static int const number_of_processors = ink_number_of_processors(); +static int num_of_net_threads = DEFAULT_NUMBER_OF_THREADS; extern int num_of_cluster_threads; -int num_of_udp_threads = DEFAULT_NUMBER_OF_UDP_THREADS; -int num_accept_threads = DEFAULT_NUM_ACCEPT_THREADS; -int num_task_threads = DEFAULT_NUM_TASK_THREADS; -int run_test_hook = 0; -char http_accept_port_descriptor[TS_ARG_MAX + 1]; +static int num_of_udp_threads = DEFAULT_NUMBER_OF_UDP_THREADS; +static int num_accept_threads = DEFAULT_NUM_ACCEPT_THREADS; +static int num_task_threads = DEFAULT_NUM_TASK_THREADS; +static int run_test_hook = 0; +static char http_accept_port_descriptor[TS_ARG_MAX + 1]; #define TS_ARG_MAX_STR_FMT "S" TS_ARG_MAX_STR int http_accept_file_descriptor = NO_FD; -int ssl_accept_file_descriptor = NO_FD; -char core_file[255] = ""; -bool enable_core_file_p = false; // Enable core file dump? +static char core_file[255] = ""; +static bool enable_core_file_p = false; // Enable core file dump? int command_flag = DEFAULT_COMMAND_FLAG; #if TS_HAS_TESTS -char regression_test[1024] = ""; +static char regression_test[1024] = ""; #endif int auto_clear_hostdb_flag = 0; int lock_process = DEFAULT_LOCK_PROCESS; @@ -146,7 +147,7 @@ char cluster_host[MAXDNAME + 1] = DEFAULT_CLUSTER_HOST; // = DEFAULT_CLUSTER_PORT_NUMBER; char proxy_name[MAXDNAME + 1] = "unknown"; -char command_string[512] = ""; +static char command_string[512] = ""; int remote_management_flag = DEFAULT_REMOTE_MANAGEMENT_FLAG; char management_directory[PATH_NAME_MAX+1]; // Layout->sysconfdir @@ -155,18 +156,16 @@ char system_runtime_dir[PATH_NAME_MAX + 1]; // Layout->runtimedir char system_config_directory[PATH_NAME_MAX + 1]; // Layout->sysconfdir char system_log_dir[PATH_NAME_MAX + 1]; // Layout->logdir -int logging_port_override = 0; -char logging_server_override[256] = " do not override"; -char error_tags[1024] = ""; -char action_tags[1024] = ""; -int show_statistics = 0; -int history_info_enabled = 1; +static char error_tags[1024] = ""; +static char action_tags[1024] = ""; +static int show_statistics = 0; +static int history_info_enabled = 1; //inkcoreapi Diags *diags = NULL; -inkcoreapi DiagsConfig *diagsConfig = NULL; +static inkcoreapi DiagsConfig *diagsConfig = NULL; HttpBodyFactory *body_factory = NULL; -int diags_init = 0; // used by process manager +static int diags_init = 0; // used by process manager -char vingid_flag[255] = ""; +static char vingid_flag[255] = ""; static int accept_mss = 0; static int cmd_line_dprintf_level = 0; // default debug output level fro ink_dprintf function @@ -176,7 +175,6 @@ AppVersionInfo appVersionInfo; // Build info for this application #if TS_HAS_TESTS extern int run_TestHook(); #endif -void deinitSubAgent(); const Version version = { {CACHE_DB_MAJOR_VERSION, CACHE_DB_MINOR_VERSION}, // cacheDB @@ -677,7 +675,7 @@ cmd_clear(char *cmd) static int cmd_help(char *cmd); -static struct CMD +static const struct CMD { const char *n; // name const char *d; // description (part of a line) @@ -736,13 +734,11 @@ commands[] = { "EXAMPLES: help help\n" " help commit\n" "\n" "Provide a short description of a command (like this).\n", cmd_help},}; -#define N_CMDS ((int)(sizeof(commands)/sizeof(commands[0]))) - static int cmd_index(char *p) { p += strspn(p, " \t"); - for (int c = 0; c < N_CMDS; c++) { + for (int c = 0; c < SIZE(commands); c++) { const char *l = commands[c].n; while (l) { const char *s = strchr(l, '/'); @@ -766,7 +762,7 @@ cmd_help(char *cmd) printf("HELP\n\n"); cmd = skip(cmd, true); if (!cmd) { - for (i = 0; i < N_CMDS; i++) { + for (i = 0; i < SIZE(commands); i++) { printf("%15s %s\n", commands[i].n, commands[i].d); } } else { @@ -1186,7 +1182,7 @@ chdir_root() } -int +static int getNumSSLThreads(void) { int num_of_ssl_threads = 0; @@ -1266,7 +1262,7 @@ adjust_num_of_net_threads(void) * Change the uid and gid to what is in the passwd entry for supplied user name. * @param user User name in the passwd file to change the uid and gid to. */ -void +static void change_uid_gid(const char *user) { struct passwd pwbuf; @@ -1526,7 +1522,6 @@ main(int argc, char **argv) { XMLDom schema; - bool xmlBandwidthSchemaRead(XMLNode * node); //char *configPath = TS_ConfigReadString("proxy.config.config_dir"); char *filename = TS_ConfigReadString("proxy.config.bandwidth_mgmt.filename"); char bwFilename[PATH_NAME_MAX]; @@ -1761,8 +1756,6 @@ main(int argc, char **argv) /////////////////////////////////////////// updateManager.start(); - void *mgmt_restart_shutdown_callback(void *, char *, int data_len); - pmgmt->registerMgmtCallback(MGMT_EVENT_SHUTDOWN, mgmt_restart_shutdown_callback, NULL); pmgmt->registerMgmtCallback(MGMT_EVENT_RESTART, mgmt_restart_shutdown_callback, NULL); @@ -1795,7 +1788,7 @@ main(int argc, char **argv) } -bool +static bool xmlBandwidthSchemaRead(XMLNode * node) { XMLNode *child, *c2; @@ -1882,7 +1875,7 @@ REGRESSION_TEST(Hdrs) (RegressionTest * t, int atype, int *pstatus) { } #endif -void * +static void * mgmt_restart_shutdown_callback(void *, char *, int data_len) { NOWARN_UNUSED(data_len); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c00f951d/proxy/signals.cc ---------------------------------------------------------------------- diff --git a/proxy/signals.cc b/proxy/signals.cc index 4daf6e3..6634ef3 100644 --- a/proxy/signals.cc +++ b/proxy/signals.cc @@ -47,7 +47,6 @@ typedef void (*SigActionFunc_t) (int sig); #endif int exited_children = 0; -extern int stack_trace_flag; static volatile int sigusr1_received = 0; extern int fastmemtotal;
