You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/08/06 10:48:39 UTC

[04/12] git commit: TS-1987: rip out ink_string_fast_ functions

TS-1987: rip out ink_string_fast_ functions


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

Branch: refs/heads/3.3.x
Commit: 87fce2a2752bfb586dde90f4fde4938d4f7bc107
Parents: f653a34
Author: Igor Galić <i....@brainsware.org>
Authored: Mon Aug 5 21:23:52 2013 +0200
Committer: Igor Galić <i....@brainsware.org>
Committed: Mon Aug 5 21:23:52 2013 +0200

----------------------------------------------------------------------
 lib/ts/ink_string.h | 198 -----------------------------------------------
 1 file changed, 198 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/87fce2a2/lib/ts/ink_string.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string.h b/lib/ts/ink_string.h
index ae71cc3..8703d25 100644
--- a/lib/ts/ink_string.h
+++ b/lib/ts/ink_string.h
@@ -193,204 +193,6 @@ ink_string_concatenate_two_strings(char *dest, char *s1, char *s2)
 }                               /* End ink_string_concatenate_two_strings */
 
 
-static inline void
-ink_string_fast_strncpy(char *dest, char *src, int src_size, int nbytes)
-{
-  int to_copy = nbytes < src_size ? nbytes : src_size;
-
-  ink_assert(nbytes >= 0);
-  ink_assert(src_size >= 0);
-
-  if (to_copy <= 10) {
-    switch (to_copy) {
-    case 1:
-      dest[0] = '\0';
-      break;
-    case 2:
-      dest[0] = src[0];
-      dest[1] = '\0';
-      break;
-    case 3:
-      dest[0] = src[0];
-      dest[1] = src[1];
-      dest[2] = '\0';
-      break;
-    case 4:
-      dest[0] = src[0];
-      dest[1] = src[1];
-      dest[2] = src[2];
-      dest[3] = '\0';
-      break;
-    case 5:
-      dest[0] = src[0];
-      dest[1] = src[1];
-      dest[2] = src[2];
-      dest[3] = src[3];
-      dest[4] = '\0';
-      break;
-    case 6:
-      dest[0] = src[0];
-      dest[1] = src[1];
-      dest[2] = src[2];
-      dest[3] = src[3];
-      dest[4] = src[4];
-      dest[5] = '\0';
-      break;
-    case 7:
-      dest[0] = src[0];
-      dest[1] = src[1];
-      dest[2] = src[2];
-      dest[3] = src[3];
-      dest[4] = src[4];
-      dest[5] = src[5];
-      dest[6] = '\0';
-      break;
-    case 8:
-      dest[0] = src[0];
-      dest[1] = src[1];
-      dest[2] = src[2];
-      dest[3] = src[3];
-      dest[4] = src[4];
-      dest[5] = src[5];
-      dest[6] = src[6];
-      dest[7] = '\0';
-      break;
-    case 9:
-      dest[0] = src[0];
-      dest[1] = src[1];
-      dest[2] = src[2];
-      dest[3] = src[3];
-      dest[4] = src[4];
-      dest[5] = src[5];
-      dest[6] = src[6];
-      dest[7] = src[7];
-      dest[8] = '\0';
-      break;
-    case 10:
-      dest[0] = src[0];
-      dest[1] = src[1];
-      dest[2] = src[2];
-      dest[3] = src[3];
-      dest[4] = src[4];
-      dest[5] = src[5];
-      dest[6] = src[6];
-      dest[7] = src[7];
-      dest[8] = src[8];
-      dest[9] = '\0';
-      break;
-    default:
-      ink_warning("Error in ink_string_fast_strncpy no copy performed d: %s s: %s n: %d\n", dest, src, nbytes);
-      break;
-    }
-  } else if (to_copy <= 1500) {
-    int i;
-    for (i = 0; i < (to_copy - 1); i++) {
-      dest[i] = src[i];
-    }
-    dest[i] = '\0';
-  } else {
-    memcpy(dest, src, (to_copy - 1));
-    dest[to_copy] = '\0';
-  }
-  return;
-}
-
-static inline int
-ink_string_fast_strncasecmp(const char *s0, const char *s1, int n)
-{
-  int i;
-  for (i = 0; (i < n) && (ParseRules::ink_tolower(s0[i]) == ParseRules::ink_tolower(s1[i])); i++);
-  if (i == n)
-    return 0;
-  else
-    return 1;
-}
-
-static inline int
-ink_string_fast_strcasecmp(const char *s0, const char *s1)
-{
-  const char *s = s0, *p = s1;
-  while (*s && *p && (ParseRules::ink_tolower(*s) == ParseRules::ink_tolower(*p))) {
-    s++;
-    p++;
-  }
-  if (!(*s) && !(*p))
-    return 0;
-  else
-    return 1;
-}
-
-static inline int
-ink_string_fast_strcmp(const char *s0, const char *s1)
-{
-  const char *s = s0, *p = s1;
-
-  while (*s && *p && *s == *p) {
-    s++;
-    p++;
-  }
-  if (!(*s) && !(*p))
-    return 0;
-  else
-    return 1;
-}
-
-static inline char *
-ink_string_fast_strcpy(char *dest, char *src)
-{
-  char *s = src, *d = dest;
-
-  while (*s != '\0')
-    *d++ = *s++;
-  *d = '\0';
-  return dest;
-}
-
-static inline int
-ink_string_strlen(const char *str)
-{
-  int i;
-
-  if (str[0] == '\0')
-    return (0);
-  else if (str[1] == '\0')
-    return (1);
-  else if (str[2] == '\0')
-    return (2);
-  else if (str[3] == '\0')
-    return (3);
-  else if (str[4] == '\0')
-    return (4);
-  else {
-    for (i = 5; i < 16; i++)
-      if (str[i] == '\0')
-        return (i);
-    return ((int) (16 + strlen(&(str[16]))));
-  }
-}
-
-static inline int
-ink_string_fast_strlen(char *src)
-{
-  int i;
-  if (!src) {
-    return -1;
-  }
-  for (i = 0; src[i] != '\0'; i++);
-  return i;
-}
-
-static inline char *
-ink_string_fast_max_strcpy(char *s0, char *s1, int max)
-{
-  int i, rmax = max - 1;
-  char *s = s0, *p = s1;
-  for (i = 0; i < rmax && *p != '\0'; i++)
-    *s++ = *p++;
-  *s = '\0';
-  return s0;
-}
-
 // inline int ptr_len_cmp(const char* p1, int l1, const char* p2, int l2)
 //
 //     strcmp() functionality for two ptr length pairs