trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject [15/21] git commit: TS-1314: Remove global TS_ARG_MAX usage
Date Fri, 21 Sep 2012 10:04:40 GMT
TS-1314: Remove global TS_ARG_MAX usage


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

Branch: refs/heads/3.2.x
Commit: d566c5ea1c54e5cad21132ba1f9ffb53fdda1601
Parents: 1a3fda6
Author: James Peach <jpeach@apache.org>
Authored: Thu Jun 28 20:54:28 2012 -0700
Committer: Igor Galić <i.galic@brainsware.org>
Committed: Fri Sep 21 08:49:04 2012 +0200

----------------------------------------------------------------------
 lib/ts/ink_args.cc |    7 ++++++-
 lib/ts/ink_args.h  |    1 +
 proxy/Main.cc      |    7 +++----
 3 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d566c5ea/lib/ts/ink_args.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_args.cc b/lib/ts/ink_args.cc
index a27bc63..c4ac0d6 100644
--- a/lib/ts/ink_args.cc
+++ b/lib/ts/ink_args.cc
@@ -83,7 +83,12 @@ process_arg(const ArgumentDescription * argument_descriptions,
         *(int64_t *) argument_descriptions[i].location = ink_atoi64(arg);
         break;
       case 'S':
-        ink_strlcpy((char *) argument_descriptions[i].location, arg, atoi(argument_descriptions[i].type
+ 1));
+        if (argument_descriptions[i].type[1] == '*') {
+          char ** out = (char **)argument_descriptions[i].location;
+          *out = ats_strdup(arg);
+        } else {
+          ink_strlcpy((char *) argument_descriptions[i].location, arg, atoi(argument_descriptions[i].type
+ 1));
+        }
         break;
       default:
         ink_fatal(1, (char *) "bad argument description");

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d566c5ea/lib/ts/ink_args.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_args.h b/lib/ts/ink_args.h
index 6686a93..7e19fab 100644
--- a/lib/ts/ink_args.h
+++ b/lib/ts/ink_args.h
@@ -49,6 +49,7 @@ struct ArgumentDescription
      "f" = set flag to FALSE (default is TRUE)
      "T" = toggle
      "S80" = read string, 80 chars max
+     "S*" = read unbounded string, allocating
    */
   const char *description;
   const char *type;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d566c5ea/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index f21cabe..0284066 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -129,8 +129,7 @@ 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
+static char * http_accept_port_descriptor;
 int http_accept_file_descriptor = NO_FD;
 static char core_file[255] = "";
 static bool enable_core_file_p = false; // Enable core file dump?
@@ -196,8 +195,8 @@ static const ArgumentDescription argument_descriptions[] = {
    "PROXY_ACCEPT_THREAD", NULL},
   {"accept_till_done", 'b', "Accept Till Done", "T", &accept_till_done,
    "PROXY_ACCEPT_TILL_DONE", NULL},
-  {"httpport", 'p', "Port descriptor for HTTP Accept", TS_ARG_MAX_STR_FMT,
-   http_accept_port_descriptor, "PROXY_HTTP_ACCEPT_PORT", NULL},
+  {"httpport", 'p', "Port descriptor for HTTP Accept", "S*",
+   &http_accept_port_descriptor, "PROXY_HTTP_ACCEPT_PORT", NULL},
   {"cluster_port", 'P', "Cluster Port Number", "I", &cluster_port_number,
    "PROXY_CLUSTER_PORT", NULL},
   {"dprintf_level", 'o', "Debug output level", "I", &cmd_line_dprintf_level,


Mime
View raw message