trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1166473 - in /trafficserver/traffic/trunk: configure.ac lib/ts/Regex.cc lib/ts/ink_config.h.in lib/ts/ink_string.cc lib/ts/ink_string.h mgmt/api/remote/NetworkUtilsRemote.cc
Date Wed, 07 Sep 2011 23:45:28 GMT
Author: zwoop
Date: Wed Sep  7 23:45:28 2011
New Revision: 1166473

URL: http://svn.apache.org/viewvc?rev=1166473&view=rev
Log:
TS-567 Cleanup some old references to ink_strndup etc.

Modified:
    trafficserver/traffic/trunk/configure.ac
    trafficserver/traffic/trunk/lib/ts/Regex.cc
    trafficserver/traffic/trunk/lib/ts/ink_config.h.in
    trafficserver/traffic/trunk/lib/ts/ink_string.cc
    trafficserver/traffic/trunk/lib/ts/ink_string.h
    trafficserver/traffic/trunk/mgmt/api/remote/NetworkUtilsRemote.cc

Modified: trafficserver/traffic/trunk/configure.ac
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/configure.ac?rev=1166473&r1=1166472&r2=1166473&view=diff
==============================================================================
--- trafficserver/traffic/trunk/configure.ac (original)
+++ trafficserver/traffic/trunk/configure.ac Wed Sep  7 23:45:28 2011
@@ -825,14 +825,13 @@ if test "x${enable_xml}" != "xyes"; then
 fi
 
 TS_FLAG_FUNCS([clock_gettime kqueue epoll_ctl posix_memalign posix_fadvise lrand48_r srand48_r
port_create])
-TS_FLAG_FUNCS([strndup strlcpy strlcat])
+TS_FLAG_FUNCS([strlcpy strlcat])
 
 AC_SUBST(has_clock_gettime)
 AC_SUBST(has_posix_memalign)
 AC_SUBST(has_posix_fadvise)
 AC_SUBST(has_lrand48_r)
 AC_SUBST(has_srand48_r)
-AC_SUBST(has_strndup)
 AC_SUBST(has_strlcpy)
 AC_SUBST(has_strlcat)
 

Modified: trafficserver/traffic/trunk/lib/ts/Regex.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/Regex.cc?rev=1166473&r1=1166472&r2=1166473&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/Regex.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/Regex.cc Wed Sep  7 23:45:28 2011
@@ -70,7 +70,7 @@ DFA::build(const char *pattern, REFlags 
   }
   
   ret->_idx = 0;
-  ret->_p = ink_strndup(pattern,strlen(pattern));
+  ret->_p = ats_strndup(pattern, strlen(pattern));
   ret->_next = NULL;
   return ret;
 }

Modified: trafficserver/traffic/trunk/lib/ts/ink_config.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_config.h.in?rev=1166473&r1=1166472&r2=1166473&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_config.h.in (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_config.h.in Wed Sep  7 23:45:28 2011
@@ -92,7 +92,6 @@
 #define TS_HAS_POSIX_FADVISE           @has_posix_fadvise@
 #define TS_HAS_LRAND48_R               @has_lrand48_r@
 #define TS_HAS_SRAND48_R               @has_srand48_r@
-#define TS_HAS_STRNDUP                 @has_strndup@
 #define TS_HAS_STRLCPY                 @has_strlcpy@
 #define TS_HAS_STRLCAT                 @has_strlcat@
 

Modified: trafficserver/traffic/trunk/lib/ts/ink_string.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_string.cc?rev=1166473&r1=1166472&r2=1166473&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_string.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_string.cc Wed Sep  7 23:45:28 2011
@@ -218,173 +218,6 @@ ink_string_find_dotted_extension(char *s
   return (p);
 }                               /* End ink_string_find_dotted_extension */
 
-/*---------------------------------------------------------------------------*
-
-  char *ink_string_mpath(int nstrings, char *str1, bool free1,
-    char *str2, bool free2, ...);
-
-  This routine joins multiple path components together to make
-  a new path.  Each component can optionally start with a / in which
-  case all the preceeding components are ignored.
-
-  Each component can optionally be free()d.
-
-  Space is malloc()d to hold the resulting path.
-
- *---------------------------------------------------------------------------*/
-
-char *
-ink_string_mpath(int nstrings, ...)
-{
-  va_list ap;
-
-  char *e[INK_MAX_STRING_ARRAY_SIZE];
-  bool f[INK_MAX_STRING_ARRAY_SIZE];
-  size_t s[INK_MAX_STRING_ARRAY_SIZE];
-  int slash = 0;
-  size_t ts = 0;
-  char *ns = NULL;
-  char *p;
-  int i;
-
-  if (likely(nstrings < INK_MAX_STRING_ARRAY_SIZE)) {
-    va_start(ap, nstrings);
-
-    for (i = 0; i < nstrings; i++) {
-      e[i] = va_arg(ap, char *);
-      f[i] = va_arg(ap, int);
-    }
-
-    for (i = nstrings - 1; i >= 0; i--) {
-      if (!e[i])
-        continue;
-      s[i] = strlen(e[i]);
-      ts += s[i] + 1;
-      if (e[i][0] == '/') {
-        slash = i;
-        break;
-      }
-    }
-    if ((slash == nstrings - 1) && f[slash]) {
-      for (i = 0; i < nstrings - 1; i++) {
-        if (f[i])
-          ats_free(e[i]);
-      }
-      va_end(ap);
-      return e[slash];
-    } else {
-      const size_t nsSize = ts + 1;
-      p = (ns = (char *)ats_malloc(nsSize));
-      for (i = slash; i < nstrings - 1; i++) {
-        ink_strncpy(p, e[i], (nsSize - (p - ns)));
-        p += s[i];
-        *p++ = '/';
-      }
-      ink_strncpy(p, e[nstrings - 1], (nsSize - (p - ns)));
-    }
-    for (i = 0; i < nstrings; i++) {
-      // TODO: This seems horribly wrong...
-      if (f[i])
-        ats_free(e[i]);
-    }
-    va_end(ap);
-  }
-  return ns;
-}
-
-/*---------------------------------------------------------------------------*
-
-  char *ink_string_mcopy(char *source);
-
-  This simply makes a copy of a string into freshly malloc()ed space.
-
- *---------------------------------------------------------------------------*/
-
-char *
-ink_string_mcopy(char *source)
-{
-  char *n = NULL;
-
-  if (likely(source)) {
-    const size_t nSize = strlen(source) + 1;
-    n = (char *)ats_malloc(nSize);
-    ink_strncpy(n, source, nSize);
-  }
-  return n;
-}
-
-/*---------------------------------------------------------------------------*
-
-  char *ink_string_mjoin(int nstrings, char *str1, bool free1,
-    char *str2, bool free2, ...);
-
-  This routine joins multiple strings components together to make
-  a new string.  Each component can optionally be free()d.
-
-  Space is malloc()d to hold the resulting path.
-
- *---------------------------------------------------------------------------*/
-
-char *
-ink_string_mjoin(int nstrings, ...)
-{
-  va_list ap;
-
-  char *e[INK_MAX_STRING_ARRAY_SIZE];
-  bool f[INK_MAX_STRING_ARRAY_SIZE];
-
-  size_t s[INK_MAX_STRING_ARRAY_SIZE];
-  int slash = 0;
-  size_t ts = 0;
-  char *ns = NULL;
-  char *p;
-  int i;
-
-  if (likely(nstrings < INK_MAX_STRING_ARRAY_SIZE)) {
-    va_start(ap, nstrings);
-
-    for (i = 0; i < nstrings; i++) {
-      e[i] = va_arg(ap, char *);
-      f[i] = va_arg(ap, int);
-      if (e[i]) {
-        s[i] = strlen(e[i]);
-        ts += s[i];
-      }
-    }
-    const size_t nsSize = ts + 1;
-    p = (ns = (char *)ats_malloc(nsSize));
-    for (i = slash; i < nstrings - 1; i++) {
-      ink_strncpy(p, e[i], (nsSize - (p - ns)));
-      p += s[i];
-    }
-    ink_strncpy(p, e[nstrings - 1], (nsSize - (p - ns)));
-    for (i = 0; i < nstrings; i++) {
-      if (f[i])
-        ats_free(e[i]);
-    }
-    va_end(ap);
-  }
-  return ns;
-}
-
-#if !TS_HAS_STRNDUP
-char *
-ink_strndup(const char *str, size_t n)
-{
-  char *cstr = NULL;
-
-  if (likely(str)) {
-    size_t len = strlen(str);
-    cstr = (char *)ats_malloc(len + 1);
-    // TODO: TS-567 do we really want to deal with strndup of size 0?
-    if (cstr == NULL)
-      return (NULL);
-    memcpy(cstr, str, len);
-    cstr[len] = '\0';
-  }
-  return (cstr);
-}
-#endif
 
 #if !TS_HAS_STRLCPY
 size_t

Modified: trafficserver/traffic/trunk/lib/ts/ink_string.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_string.h?rev=1166473&r1=1166472&r2=1166473&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_string.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_string.h Wed Sep  7 23:45:28 2011
@@ -55,31 +55,6 @@ inkcoreapi char *ink_string_concatenate_
 inkcoreapi char *ink_string_append(char *dest, char *src, int n);
 inkcoreapi char *ink_string_find_dotted_extension(char *str, char *ext, int max_ext_len);
 
-/* these are supposed to make your life easier */
-
-/*
- * the results of all of these are put in freshly malloc()ed memory
- */
-
-        /*
-         *  s = ink_string_mpath(2, "/foo", false, "bar", false);
-         */
-char *ink_string_mpath(int nstrings, ...);
-        /*
-         * s = ink_string_mcopy(old);
-         */
-char *ink_string_mcopy(char *source);
-        /*
-         *  s = ink_string_mjoin(2, "/foo", false, "/bar", false);
-         */
-char *ink_string_mjoin(int nstrings, ...);
-
-/* Missing fcns */
-#if TS_HAS_STRNDUP
-#define  ink_strndup strndup
-#else
-char *ink_strndup(const char *str, size_t n);
-#endif
 /*
  * Copy src to string dst of size siz.  At most siz-1 characters
  * will be copied.  Always NUL terminates (unless siz == 0).

Modified: trafficserver/traffic/trunk/mgmt/api/remote/NetworkUtilsRemote.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/remote/NetworkUtilsRemote.cc?rev=1166473&r1=1166472&r2=1166473&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/remote/NetworkUtilsRemote.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/remote/NetworkUtilsRemote.cc Wed Sep  7 23:45:28
2011
@@ -1263,7 +1263,7 @@ parse_file_read_reply(int fd, int *ver, 
 
   // check size before reading text
   if ((*size) <= 0) {
-    *text = ink_strndup("", 1);                 // set to empty string
+    *text = ats_strndup("", 1);                 // set to empty string
   } else {
     // now we got the size, we can read everything into our msg * then parse it
     *text = (char *)ats_malloc(sizeof(char) * (f_size + 1));



Mime
View raw message