src/string.c

changeset 319
0380e438a7ce
parent 318
348fd9cb7b14
child 361
8ee9e23adbd2
     1.1 --- a/src/string.c	Wed May 16 14:02:59 2018 +0200
     1.2 +++ b/src/string.c	Wed May 16 18:56:44 2018 +0200
     1.3 @@ -65,7 +65,7 @@
     1.4  }
     1.5  
     1.6  
     1.7 -size_t ucx_strnlen(size_t n, ...) {
     1.8 +size_t scstrnlen(size_t n, ...) {
     1.9      va_list ap;
    1.10      va_start(ap, n);
    1.11      
    1.12 @@ -150,7 +150,7 @@
    1.13      return str;
    1.14  }
    1.15  
    1.16 -sstr_t ucx_strcat(size_t count, scstr_t s1, ...) {
    1.17 +sstr_t scstrcat(size_t count, scstr_t s1, ...) {
    1.18      va_list ap;
    1.19      va_start(ap, s1);
    1.20      sstr_t s = sstrvcat_a(ucx_default_allocator(), count, s1, ap);
    1.21 @@ -158,7 +158,7 @@
    1.22      return s;
    1.23  }
    1.24  
    1.25 -sstr_t ucx_strcat_a(UcxAllocator *a, size_t count, scstr_t s1, ...) {
    1.26 +sstr_t scstrcat_a(UcxAllocator *a, size_t count, scstr_t s1, ...) {
    1.27      va_list ap;
    1.28      va_start(ap, s1);
    1.29      sstr_t s = sstrvcat_a(a, count, s1, ap);
    1.30 @@ -348,7 +348,7 @@
    1.31      return result;
    1.32  }
    1.33  
    1.34 -sstr_t ucx_sstrstr(sstr_t string, scstr_t match) {
    1.35 +sstr_t scstrsstr(sstr_t string, scstr_t match) {
    1.36      sstr_t result;
    1.37      
    1.38      size_t reslen;
    1.39 @@ -366,7 +366,7 @@
    1.40      return result;
    1.41  }
    1.42  
    1.43 -scstr_t ucx_scstrstr(scstr_t string, scstr_t match) {
    1.44 +scstr_t scstrscstr(scstr_t string, scstr_t match) {
    1.45      scstr_t result;
    1.46      
    1.47      size_t reslen;
    1.48 @@ -387,11 +387,11 @@
    1.49  #undef ptable_r
    1.50  #undef ptable_w
    1.51  
    1.52 -sstr_t* ucx_strsplit(scstr_t s, scstr_t d, ssize_t *n) {
    1.53 -    return ucx_strsplit_a(ucx_default_allocator(), s, d, n);
    1.54 +sstr_t* scstrsplit(scstr_t s, scstr_t d, ssize_t *n) {
    1.55 +    return scstrsplit_a(ucx_default_allocator(), s, d, n);
    1.56  }
    1.57  
    1.58 -sstr_t* ucx_strsplit_a(UcxAllocator *allocator, scstr_t s, scstr_t d, ssize_t *n) {
    1.59 +sstr_t* scstrsplit_a(UcxAllocator *allocator, scstr_t s, scstr_t d, ssize_t *n) {
    1.60      if (s.length == 0 || d.length == 0) {
    1.61          *n = -1;
    1.62          return NULL;
    1.63 @@ -435,7 +435,7 @@
    1.64                      match.length--;
    1.65                  }
    1.66              } else {
    1.67 -                match = scstrstr(curpos, d);
    1.68 +                match = scstrscstr(curpos, d);
    1.69              }
    1.70              if (match.length > 0) {
    1.71                  /* is this our last try? */
    1.72 @@ -487,7 +487,7 @@
    1.73      return result;
    1.74  }
    1.75  
    1.76 -int ucx_strcmp(scstr_t s1, scstr_t s2) {
    1.77 +int scstrcmp(scstr_t s1, scstr_t s2) {
    1.78      if (s1.length == s2.length) {
    1.79          return memcmp(s1.ptr, s2.ptr, s1.length);
    1.80      } else if (s1.length > s2.length) {
    1.81 @@ -497,7 +497,7 @@
    1.82      }
    1.83  }
    1.84  
    1.85 -int ucx_strcasecmp(scstr_t s1, scstr_t s2) {
    1.86 +int scstrcasecmp(scstr_t s1, scstr_t s2) {
    1.87      if (s1.length == s2.length) {
    1.88  #ifdef _WIN32
    1.89          return _strnicmp(s1.ptr, s2.ptr, s1.length);
    1.90 @@ -511,11 +511,11 @@
    1.91      }
    1.92  }
    1.93  
    1.94 -sstr_t ucx_strdup(scstr_t s) {
    1.95 +sstr_t scstrdup(scstr_t s) {
    1.96      return sstrdup_a(ucx_default_allocator(), s);
    1.97  }
    1.98  
    1.99 -sstr_t ucx_strdup_a(UcxAllocator *allocator, scstr_t s) {
   1.100 +sstr_t scstrdup_a(UcxAllocator *allocator, scstr_t s) {
   1.101      sstr_t newstring;
   1.102      newstring.ptr = (char*)almalloc(allocator, s.length + 1);
   1.103      if (newstring.ptr) {
   1.104 @@ -561,7 +561,7 @@
   1.105      return newstr;
   1.106  }
   1.107  
   1.108 -int ucx_strprefix(scstr_t string, scstr_t prefix) {
   1.109 +int scstrprefix(scstr_t string, scstr_t prefix) {
   1.110      if (string.length == 0) {
   1.111          return prefix.length == 0;
   1.112      }
   1.113 @@ -576,7 +576,7 @@
   1.114      }
   1.115  }
   1.116  
   1.117 -int ucx_strsuffix(scstr_t string, scstr_t suffix) {
   1.118 +int scstrsuffix(scstr_t string, scstr_t suffix) {
   1.119      if (string.length == 0) {
   1.120          return suffix.length == 0;
   1.121      }
   1.122 @@ -592,7 +592,7 @@
   1.123      }
   1.124  }
   1.125  
   1.126 -sstr_t ucx_strlower(scstr_t string) {
   1.127 +sstr_t scstrlower(scstr_t string) {
   1.128      sstr_t ret = sstrdup(string);
   1.129      for (size_t i = 0; i < ret.length ; i++) {
   1.130          ret.ptr[i] = tolower(ret.ptr[i]);
   1.131 @@ -600,7 +600,7 @@
   1.132      return ret;
   1.133  }
   1.134  
   1.135 -sstr_t ucx_strlower_a(UcxAllocator *allocator, scstr_t string) {
   1.136 +sstr_t scstrlower_a(UcxAllocator *allocator, scstr_t string) {
   1.137      sstr_t ret = sstrdup_a(allocator, string);
   1.138      for (size_t i = 0; i < ret.length ; i++) {
   1.139          ret.ptr[i] = tolower(ret.ptr[i]);
   1.140 @@ -608,7 +608,7 @@
   1.141      return ret;
   1.142  }
   1.143  
   1.144 -sstr_t ucx_strupper(scstr_t string) {
   1.145 +sstr_t scstrupper(scstr_t string) {
   1.146      sstr_t ret = sstrdup(string);
   1.147      for (size_t i = 0; i < ret.length ; i++) {
   1.148          ret.ptr[i] = toupper(ret.ptr[i]);
   1.149 @@ -616,7 +616,7 @@
   1.150      return ret;
   1.151  }
   1.152  
   1.153 -sstr_t ucx_strupper_a(UcxAllocator *allocator, scstr_t string) {
   1.154 +sstr_t scstrupper_a(UcxAllocator *allocator, scstr_t string) {
   1.155      sstr_t ret = sstrdup_a(allocator, string);
   1.156      for (size_t i = 0; i < ret.length ; i++) {
   1.157          ret.ptr[i] = toupper(ret.ptr[i]);

mercurial