trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject [12/21] git commit: TS-1314: Apply const to argument descriptions
Date Fri, 21 Sep 2012 10:04:40 GMT
TS-1314: Apply const to argument descriptions


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1055f7f6
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1055f7f6
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1055f7f6

Branch: refs/heads/3.2.x
Commit: 1055f7f6b6cce057e9a12f876d970e32343edd1b
Parents: ee5d477
Author: James Peach <jpeach@apache.org>
Authored: Mon Jun 25 21:57:52 2012 -0700
Committer: Igor Galić <i.galic@brainsware.org>
Committed: Fri Sep 21 08:49:04 2012 +0200

----------------------------------------------------------------------
 lib/ts/ink_args.cc |   22 +++++++++++-----------
 lib/ts/ink_args.h  |   16 ++++++++--------
 proxy/Main.cc      |    6 +++---
 proxy/Main.h       |    2 +-
 4 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1055f7f6/lib/ts/ink_args.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_args.cc b/lib/ts/ink_args.cc
index f803ebf..a27bc63 100644
--- a/lib/ts/ink_args.cc
+++ b/lib/ts/ink_args.cc
@@ -33,16 +33,16 @@ Process arguments
 //  Global variables
 //
 
-char *file_arguments[MAX_FILE_ARGUMENTS] = { 0 };
-char *program_name = (char *) "Traffic Server";
-int n_file_arguments = 0;
+const char *file_arguments[MAX_FILE_ARGUMENTS] = { 0 };
+const char *program_name = (char *) "Traffic Server";
+unsigned n_file_arguments = 0;
 
 //
 //  Local variables
 //
 
-static char *argument_types_keys = (char *) "ISDfFTL";
-static char *argument_types_descriptions[] = {
+static const char *argument_types_keys = (char *) "ISDfFTL";
+static const char *argument_types_descriptions[] = {
   (char *) "int  ",
   (char *) "str  ",
   (char *) "dbl  ",
@@ -58,8 +58,8 @@ static char *argument_types_descriptions[] = {
 //
 
 static void
-process_arg(ArgumentDescription * argument_descriptions,
-            int n_argument_descriptions, int i, char ***argv, const char *usage_string)
+process_arg(const ArgumentDescription * argument_descriptions,
+            unsigned n_argument_descriptions, int i, char ***argv, const char *usage_string)
 {
   char *arg = NULL;
   if (argument_descriptions[i].type) {
@@ -98,7 +98,7 @@ process_arg(ArgumentDescription * argument_descriptions,
 
 
 void
-show_argument_configuration(ArgumentDescription * argument_descriptions, int n_argument_descriptions)
+show_argument_configuration(const ArgumentDescription * argument_descriptions, unsigned n_argument_descriptions)
 {
   int i = 0;
   printf("Argument Configuration\n");
@@ -133,9 +133,9 @@ show_argument_configuration(ArgumentDescription * argument_descriptions,
int n_a
 }
 
 void
-process_args(ArgumentDescription * argument_descriptions, int n_argument_descriptions, char
**argv, const char *usage_string)
+process_args(const ArgumentDescription * argument_descriptions, unsigned n_argument_descriptions,
char **argv, const char *usage_string)
 {
-  int i = 0;
+  unsigned i = 0;
   //
   // Grab Environment Variables
   //
@@ -197,7 +197,7 @@ process_args(ArgumentDescription * argument_descriptions, int n_argument_descrip
 }
 
 void
-usage(ArgumentDescription * argument_descriptions, int n_argument_descriptions, const char
*usage_string)
+usage(const ArgumentDescription * argument_descriptions, unsigned n_argument_descriptions,
const char *usage_string)
 {
   (void) argument_descriptions;
   (void) n_argument_descriptions;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1055f7f6/lib/ts/ink_args.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_args.h b/lib/ts/ink_args.h
index de6d34a..6686a93 100644
--- a/lib/ts/ink_args.h
+++ b/lib/ts/ink_args.h
@@ -34,7 +34,7 @@ Process arguments
 
 struct ArgumentDescription;
 
-typedef void ArgumentFunction(ArgumentDescription * argument_descriptions, int n_argument_descriptions,
const char *arg);
+typedef void ArgumentFunction(const ArgumentDescription * argument_descriptions, unsigned
n_argument_descriptions, const char *arg);
 
 struct ArgumentDescription
 {
@@ -59,19 +59,19 @@ struct ArgumentDescription
 
 /* Global Data
 */
-extern char *file_arguments[];  // exported by process_args()
-extern int n_file_arguments;    // exported by process_args()
-extern char *program_name;      // exported by process_args()
+extern const char *file_arguments[];  // exported by process_args()
+extern unsigned n_file_arguments;    // exported by process_args()
+extern const char *program_name;      // exported by process_args()
 
 /* Print out arguments and values
 */
-void show_argument_configuration(ArgumentDescription * argument_descriptions, int n_argument_descriptions);
+void show_argument_configuration(const ArgumentDescription * argument_descriptions, unsigned
n_argument_descriptions);
 
-void usage(ArgumentDescription * argument_descriptions, int n_argument_descriptions, const
char *arg_unused);
+void usage(const ArgumentDescription * argument_descriptions, unsigned n_argument_descriptions,
const char *arg_unused);
 
 /* Process all arguments
 */
-void process_args(ArgumentDescription * argument_descriptions,
-                  int n_argument_descriptions, char **argv, const char *usage_string = 0);
+void process_args(const ArgumentDescription * argument_descriptions,
+                  unsigned n_argument_descriptions, char **argv, const char *usage_string
= 0);
 
 #endif /*_INK_ARGS_H*/

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1055f7f6/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 0dbbbd7..7bbc914 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -178,14 +178,14 @@ extern int run_TestHook();
 #endif
 void deinitSubAgent();
 
-Version version = {
+const Version version = {
   {CACHE_DB_MAJOR_VERSION, CACHE_DB_MINOR_VERSION},     // cacheDB
   {CACHE_DIR_MAJOR_VERSION, CACHE_DIR_MINOR_VERSION},   // cacheDir
   {CLUSTER_MAJOR_VERSION, CLUSTER_MINOR_VERSION},       // current clustering
   {MIN_CLUSTER_MAJOR_VERSION, MIN_CLUSTER_MINOR_VERSION},       // min clustering
 };
 
-ArgumentDescription argument_descriptions[] = {
+static const ArgumentDescription argument_descriptions[] = {
   {"lock_memory", 'l', "Lock process in memory (must be root)",
    "I", &lock_process, "PROXY_LOCK_PROCESS", NULL},
   {"net_threads", 'n', "Number of Net Threads", "I", &num_of_net_threads,
@@ -262,7 +262,7 @@ ArgumentDescription argument_descriptions[] = {
    NULL, NULL},
   {"help", 'h', "HELP!", NULL, NULL, NULL, usage},
 };
-int n_argument_descriptions = SIZE(argument_descriptions);
+static const unsigned n_argument_descriptions = SIZE(argument_descriptions);
 
 //
 // Initialize operating system related information/services

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1055f7f6/proxy/Main.h
----------------------------------------------------------------------
diff --git a/proxy/Main.h b/proxy/Main.h
index 9ce0375..39b74a5 100644
--- a/proxy/Main.h
+++ b/proxy/Main.h
@@ -85,7 +85,7 @@ maintainance_mode()
 
 void syslog_thr_init();
 
-extern Version version;
+extern const Version version;
 extern AppVersionInfo appVersionInfo;
 
 #define TS_ReadConfigInteger            REC_ReadConfigInteger


Mime
View raw message