trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject [1/2] git commit: TS-2097: remove ink_strtok_r() wrapper
Date Mon, 05 Aug 2013 22:17:14 GMT
Updated Branches:
  refs/heads/master 54ea3f7be -> 267640b3d


TS-2097: remove ink_strtok_r() wrapper


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

Branch: refs/heads/master
Commit: aae0505bc827f4accde5973b6cf485b1c157943c
Parents: 54ea3f7
Author: Igor Galić <i.galic@brainsware.org>
Authored: Mon Aug 5 23:34:27 2013 +0200
Committer: Igor Galić <i.galic@brainsware.org>
Committed: Mon Aug 5 23:34:27 2013 +0200

----------------------------------------------------------------------
 cop/TrafficCop.cc             |  4 ++--
 iocore/dns/DNS.cc             |  4 ++--
 lib/records/RecConfigParse.cc |  6 +++---
 lib/ts/ink_string.cc          |  6 ------
 lib/ts/ink_string.h           |  3 ---
 mgmt/LocalManager.cc          |  4 ++--
 mgmt/api/CfgContextUtils.cc   |  2 +-
 mgmt/cluster/ClusterCom.cc    | 32 ++++++++++++++++----------------
 8 files changed, 26 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae0505b/cop/TrafficCop.cc
----------------------------------------------------------------------
diff --git a/cop/TrafficCop.cc b/cop/TrafficCop.cc
index d1368fa..8cf97ee 100644
--- a/cop/TrafficCop.cc
+++ b/cop/TrafficCop.cc
@@ -708,10 +708,10 @@ spawn_manager()
   }
   options[0] = prog;
   i = 1;
-  tok = ink_strtok_r(manager_options, " ", &last);
+  tok = strtok_r(manager_options, " ", &last);
   options[i++] = tok;
   if (tok != NULL) {
-    while (i < OPTIONS_MAX && (tok = ink_strtok_r(NULL, " ", &last))) {
+    while (i < OPTIONS_MAX && (tok = strtok_r(NULL, " ", &last))) {
       options[i++] = tok;
     }
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae0505b/iocore/dns/DNS.cc
----------------------------------------------------------------------
diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index 7dec6a5..a84c8c0 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -247,7 +247,7 @@ DNSProcessor::dns_init()
     int i;
     char *last;
     char *ns_list = ats_strdup(dns_ns_list);
-    char *ns = (char *) ink_strtok_r(ns_list, " ,;\t\r", &last);
+    char *ns = (char *) strtok_r(ns_list, " ,;\t\r", &last);
 
     for (i = 0, nserv = 0 ; (i < MAX_NAMED) && ns ; ++i) {
       Debug("dns", "Nameserver list - parsing \"%s\"\n", ns);
@@ -292,7 +292,7 @@ DNSProcessor::dns_init()
         ++nserv;
       }
 
-      ns = (char *) ink_strtok_r(NULL, " ,;\t\r", &last);
+      ns = (char *) strtok_r(NULL, " ,;\t\r", &last);
     }
     ats_free(ns_list);
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae0505b/lib/records/RecConfigParse.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecConfigParse.cc b/lib/records/RecConfigParse.cc
index f6cd3cc..e4fff37 100644
--- a/lib/records/RecConfigParse.cc
+++ b/lib/records/RecConfigParse.cc
@@ -153,15 +153,15 @@ RecConfigFileParse(const char * path, RecConfigEntryCallback handler)
 
     while (isspace(*lt))
       lt++;
-    rec_type_str = ink_strtok_r(lt, " \t", &ln);
+    rec_type_str = strtok_r(lt, " \t", &ln);
 
     // check for blank lines and comments
     if ((!rec_type_str) || (rec_type_str && (*rec_type_str == '#'))) {
       goto L_next_line;
     }
 
-    name_str = ink_strtok_r(NULL, " \t", &ln);
-    data_type_str = ink_strtok_r(NULL, " \t", &ln);
+    name_str = strtok_r(NULL, " \t", &ln);
+    data_type_str = strtok_r(NULL, " \t", &ln);
 
     // extract the string data (a little bit tricker since it can have spaces)
     if (ln) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae0505b/lib/ts/ink_string.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string.cc b/lib/ts/ink_string.cc
index d38f0e8..3ce655a 100644
--- a/lib/ts/ink_string.cc
+++ b/lib/ts/ink_string.cc
@@ -270,9 +270,3 @@ ink_strlcat(char *dst, const char *src, size_t siz)
 }
 #endif
 
-char *
-ink_strtok_r(char *s1, const char *s2, char **lasts)
-{
-  return strtok_r(s1, s2, lasts);
-}
-

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae0505b/lib/ts/ink_string.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string.h b/lib/ts/ink_string.h
index c553a3e..7048ada 100644
--- a/lib/ts/ink_string.h
+++ b/lib/ts/ink_string.h
@@ -79,9 +79,6 @@ size_t ink_strlcpy(char *dst, const char *str, size_t siz);
 size_t ink_strlcat(char *dst, const char *str, size_t siz);
 #endif
 
-/* 9/3/98 elam: Added this because NT doesn't have strtok_r() */
-char *ink_strtok_r(char *s1, const char *s2, char **lasts);
-
 inkcoreapi int ink_strcasecmp(const char *a, const char *b);
 inkcoreapi int ink_strncasecmp(const char *a, const char *b, unsigned int max);
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae0505b/mgmt/LocalManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index a102685..863a771 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -1038,9 +1038,9 @@ LocalManager::startProxy()
     ink_zero(options);
     options[0] = absolute_proxy_binary;
     i = 1;
-    tok = ink_strtok_r(&real_proxy_options[0], " ", &last);
+    tok = strtok_r(&real_proxy_options[0], " ", &last);
     options[i++] = tok;
-    while (i < 32 && (tok = ink_strtok_r(NULL, " ", &last))) {
+    while (i < 32 && (tok = strtok_r(NULL, " ", &last))) {
       Debug("lm", "opt %d = '%s'\n", i, tok);
       options[i++] = tok;
     }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae0505b/mgmt/api/CfgContextUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CfgContextUtils.cc b/mgmt/api/CfgContextUtils.cc
index 2be8046..f94b10c 100644
--- a/mgmt/api/CfgContextUtils.cc
+++ b/mgmt/api/CfgContextUtils.cc
@@ -760,7 +760,7 @@ string_to_domain(const char *str)
 
   // get hostname
   ink_strlcpy(buf, str, sizeof(buf));
-  token = ink_strtok_r(buf, ":", &token_pos);
+  token = strtok_r(buf, ":", &token_pos);
   remain = token_pos;
   if (token)
     dom->domain_val = ats_strdup(token);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae0505b/mgmt/cluster/ClusterCom.cc
----------------------------------------------------------------------
diff --git a/mgmt/cluster/ClusterCom.cc b/mgmt/cluster/ClusterCom.cc
index 4f8344c..a365412 100644
--- a/mgmt/cluster/ClusterCom.cc
+++ b/mgmt/cluster/ClusterCom.cc
@@ -690,7 +690,7 @@ ClusterCom::handleMultiCastMessage(char *message)
 
   /* Grab the ip address, we need to know this so that we only complain
      once about a cluster name or traffic server version mismatch */
-  if ((line = ink_strtok_r(message, "\n", &last)) == NULL)
+  if ((line = strtok_r(message, "\n", &last)) == NULL)
     goto Lbogus;                /* IP of sender */
 
   // coverity[secure_coding]
@@ -705,7 +705,7 @@ ClusterCom::handleMultiCastMessage(char *message)
   }
 
   /* Make sure this is a message for the cluster we belong to */
-  if ((line = ink_strtok_r(NULL, "\n", &last)) == NULL)
+  if ((line = strtok_r(NULL, "\n", &last)) == NULL)
     goto Lbogus;                /* ClusterName of sender */
 
   // coverity[secure_coding]
@@ -718,7 +718,7 @@ ClusterCom::handleMultiCastMessage(char *message)
   }
 
   /* Make sure this a message from a Traffic Server of the same version */
-  if ((line = ink_strtok_r(NULL, "\n", &last)) == NULL)
+  if ((line = strtok_r(NULL, "\n", &last)) == NULL)
     goto Lbogus;                /* TS version of sender */
 
   // coverity[secure_coding]
@@ -728,7 +728,7 @@ ClusterCom::handleMultiCastMessage(char *message)
   }
 
   /* Figure out what type of message this is */
-  if ((line = ink_strtok_r(NULL, "\n", &last)) == NULL)
+  if ((line = strtok_r(NULL, "\n", &last)) == NULL)
     goto Lbogus;
   if (strcmp("type: files", line) == 0) {       /* Config Files report */
     handleMultiCastFilePacket(last, ip);
@@ -747,7 +747,7 @@ ClusterCom::handleMultiCastMessage(char *message)
   }
 
   /* Check OS and version info */
-  if ((line = ink_strtok_r(NULL, "\n", &last)) == NULL)
+  if ((line = strtok_r(NULL, "\n", &last)) == NULL)
     goto Lbogus;                /* OS of sender */
   if (!strstr(line, "os: ") || !strstr(line, sys_name)) {
     lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_PROXY_SYSTEM_ERROR,
@@ -757,7 +757,7 @@ ClusterCom::handleMultiCastMessage(char *message)
               "running different os/release '%s'(ours os: '%s' rel: '%s'\n", line, sys_name,
sys_release);
   }
 
-  if ((line = ink_strtok_r(NULL, "\n", &last)) == NULL)
+  if ((line = strtok_r(NULL, "\n", &last)) == NULL)
     goto Lbogus;                /* OS-Version of sender */
   if (!strstr(line, "rel: ") || !strstr(line, sys_release)) {
     lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_PROXY_SYSTEM_ERROR,
@@ -767,21 +767,21 @@ ClusterCom::handleMultiCastMessage(char *message)
               "running different os/release '%s'(ours os: '%s' rel: '%s'\n", line, sys_name,
sys_release);
   }
 
-  if ((line = ink_strtok_r(NULL, "\n", &last)) == NULL)
+  if ((line = strtok_r(NULL, "\n", &last)) == NULL)
     goto Lbogus;                /* Hostname of sender */
   if (strlen(line) >= sizeof(hostname) || sscanf(line, "hostname: %s", hostname) != 1)
{
     mgmt_elog("[ClusterCom::handleMultiCastMessage] Invalid message-line(%d) '%s'\n", __LINE__,
line);
     return;
   }
 
-  if ((line = ink_strtok_r(NULL, "\n", &last)) == NULL)
+  if ((line = strtok_r(NULL, "\n", &last)) == NULL)
     goto Lbogus;                /* mc_port of sender */
   if (sscanf(line, "port: %d", &peer_cluster_port) != 1) {
     mgmt_elog("[ClusterCom::handleMultiCastMessage] Invalid message-line(%d) '%s'\n", __LINE__,
line);
     return;
   }
 
-  if ((line = ink_strtok_r(NULL, "\n", &last)) == NULL)
+  if ((line = strtok_r(NULL, "\n", &last)) == NULL)
     goto Lbogus;                /* rs_port of sender */
   if (sscanf(line, "ccomport: %d", &ccom_port) != 1) {
     mgmt_elog("[ClusterCom::handleMultiCastMessage] Invalid message-line(%d) '%s'\n", __LINE__,
line);
@@ -789,7 +789,7 @@ ClusterCom::handleMultiCastMessage(char *message)
   }
 
   /* Their wall clock time and last config change time */
-  if ((line = ink_strtok_r(NULL, "\n", &last)) == NULL)
+  if ((line = strtok_r(NULL, "\n", &last)) == NULL)
     goto Lbogus;
   int64_t tt;
   if (sscanf(line, "time: %" PRId64 "", &tt) != 1) {
@@ -884,7 +884,7 @@ ClusterCom::handleMultiCastStatPacket(char *last, ClusterPeerInfo * peer)
 
   /* Loop over records, updating peer copy(summed later) */
   rec_ptr = &(peer->node_rec_data);
-  for (int i = 0; (line = ink_strtok_r(NULL, "\n", &last)) && i < rec_ptr->num_recs;
i++) {
+  for (int i = 0; (line = strtok_r(NULL, "\n", &last)) && i < rec_ptr->num_recs;
i++) {
 
     tmp_id = -1;
     tmp_type = RECD_NULL;
@@ -1104,7 +1104,7 @@ ClusterCom::handleMultiCastFilePacket(char *last, char *ip)
   InkHashTableValue hash_value;
   bool file_update_failure;
 
-  while ((line = ink_strtok_r(NULL, "\n", &last))) {
+  while ((line = strtok_r(NULL, "\n", &last))) {
     Rollback *rb;
 
     file_update_failure = false;
@@ -1215,7 +1215,7 @@ ClusterCom::handleMultiCastAlarmPacket(char *last, char *ip)
 
   /* Allows us to expire stale alarms */
   lmgmt->alarm_keeper->resetSeenFlag(ip);
-  while ((line = ink_strtok_r(NULL, "\n", &last))) {
+  while ((line = strtok_r(NULL, "\n", &last))) {
     int ccons;
     alarm_t a;
     char *desc;
@@ -1257,7 +1257,7 @@ ClusterCom::handleMultiCastVMapPacket(char *last, char *ip)
   lmgmt->virt_map->rl_resetSeenFlag(ip);        /* Ala alarms */
   ink_mutex_release(&(mutex));
 
-  while ((line = ink_strtok_r(NULL, "\n", &last))) {
+  while ((line = strtok_r(NULL, "\n", &last))) {
     char vaddr[80];
 
     if (strcmp(line, "virt: none") == 0) {
@@ -1514,7 +1514,7 @@ ClusterCom::constructSharedFilePacket(char *message, int max)
 
   buff = configFiles->filesManaged();
   files = buff->bufPtr();
-  line = ink_strtok_r(files, "\n", &last);
+  line = strtok_r(files, "\n", &last);
   if (line == NULL) {
     delete buff;
     return;
@@ -1553,7 +1553,7 @@ ClusterCom::constructSharedFilePacket(char *message, int max)
     } else {
       mgmt_elog("[ClusterCom::constructSharedFilePacket] Invalid base name? '%s'\n", line);
     }
-  } while ((line = ink_strtok_r(NULL, "\n", &last)));
+  } while ((line = strtok_r(NULL, "\n", &last)));
 
   delete buff;
   return;


Mime
View raw message