diff -r 348fd9cb7b14 -r 0380e438a7ce src/ucx/string.h
--- a/src/ucx/string.h Wed May 16 14:02:59 2018 +0200
+++ b/src/ucx/string.h Wed May 16 18:56:44 2018 +0200
@@ -256,9 +256,6 @@
/**
* Returns the cumulated length of all specified strings.
*
- * You may arbitrarily mix up mutable (sstr_t
) and immutable
- * (scstr_t
) strings.
- *
* Attention: if the count argument does not match the count of the
* specified strings, the behavior is undefined.
*
@@ -266,16 +263,16 @@
* @param ... all strings
* @return the cumulated length of all strings
*/
-size_t ucx_strnlen(size_t count, ...);
+size_t scstrnlen(size_t count, ...);
/**
- * Alias for ucx_strnlen().
+ * Alias for scstrnlen() which automatically casts the arguments.
*
* @param count the total number of specified strings (so at least 1)
* @param ... all strings
* @return the cumulated length of all strings
*/
-#define sstrnlen(count, ...) ucx_strnlen(count, __VA_ARGS__)
+#define sstrnlen(count, ...) scstrnlen(count, __VA_ARGS__)
/**
* Concatenates two or more strings.
@@ -291,22 +288,22 @@
* @param ... all remaining strings
* @return the concatenated string
*/
-sstr_t ucx_strcat(size_t count, scstr_t s1, ...);
+sstr_t scstrcat(size_t count, scstr_t s1, ...);
/**
- * Alias for ucx_strcat() which automatically casts the first string.
+ * Alias for scstrcat() which automatically casts the arguments.
*
* @param count the total number of strings to concatenate
* @param s1 first string
* @param ... all remaining strings
* @return the concatenated string
*/
-#define sstrcat(count, s1, ...) ucx_strcat(count, SCSTR(s1), __VA_ARGS__)
+#define sstrcat(count, s1, ...) scstrcat(count, SCSTR(s1), __VA_ARGS__)
/**
* Concatenates two or more strings using a UcxAllocator.
*
- * See sstrcat() for details.
+ * See scstrcat() for details.
*
* @param a the allocator to use
* @param count the total number of strings to concatenate
@@ -314,10 +311,10 @@
* @param ... all remaining strings
* @return the concatenated string
*/
-sstr_t ucx_strcat_a(UcxAllocator *a, size_t count, scstr_t s1, ...);
+sstr_t scstrcat_a(UcxAllocator *a, size_t count, scstr_t s1, ...);
/**
- * Alias for ucx_strcat_a() which automatically casts the first string.
+ * Alias for scstrcat_a() which automatically casts the arguments.
*
* See sstrcat() for details.
*
@@ -328,7 +325,7 @@
* @return the concatenated string
*/
#define sstrcat_a(a, count, s1, ...) \
- ucx_strcat_a(a, count, SCSTR(s1), __VA_ARGS__)
+ scstrcat_a(a, count, SCSTR(s1), __VA_ARGS__)
/**
* Returns a substring starting at the specified location.
@@ -471,10 +468,10 @@
* match
, or an empty string, if the sequence is not
* present in string
*/
-sstr_t ucx_sstrstr(sstr_t string, scstr_t match);
+sstr_t scstrsstr(sstr_t string, scstr_t match);
/**
- * Alias for ucx_sstrstr() which automatically casts the match string.
+ * Alias for scstrsstr() which automatically casts the match string.
*
* @param string the string to be scanned
* @param match string containing the sequence of characters to match
@@ -482,7 +479,7 @@
* match
, or an empty string, if the sequence is not
* present in string
*/
-#define sstrstr(string, match) ucx_sstrstr(string, SCSTR(match))
+#define sstrstr(string, match) scstrsstr(string, SCSTR(match))
/**
* Returns an immutable substring starting at the location of the
@@ -499,10 +496,10 @@
* match
, or an empty string, if the sequence is not
* present in string
*/
-scstr_t ucx_scstrstr(scstr_t string, scstr_t match);
+scstr_t scstrscstr(scstr_t string, scstr_t match);
/**
- * Alias for ucx_scstrstr() which automatically casts the match string.
+ * Alias for scstrscstr() which automatically casts the match string.
*
* @param string the string to be scanned
* @param match string containing the sequence of characters to match
@@ -510,7 +507,7 @@
* match
, or an empty string, if the sequence is not
* present in string
*/
-#define scstrstr(string, match) ucx_scstrstr(string, SCSTR(match))
+#define sstrscstr(string, match) scstrscstr(string, SCSTR(match))
/**
* Splits a string into parts by using a delimiter string.
@@ -557,12 +554,12 @@
* @return a sstr_t array containing the split strings or
* NULL
on error
*
- * @see ucx_strsplit_a()
+ * @see scstrsplit_a()
*/
-sstr_t* ucx_strsplit(scstr_t string, scstr_t delim, ssize_t *count);
+sstr_t* scstrsplit(scstr_t string, scstr_t delim, ssize_t *count);
/**
- * Alias for ucx_strsplit() which automatically casts the arguments.
+ * Alias for scstrsplit() which automatically casts the arguments.
*
* @param string the string to split
* @param delim the delimiter string
@@ -574,12 +571,12 @@
* @see sstrsplit_a()
*/
#define sstrsplit(string, delim, count) \
- ucx_strsplit(SCSTR(string), SCSTR(delim), count)
+ scstrsplit(SCSTR(string), SCSTR(delim), count)
/**
- * Performing sstrsplit() using a UcxAllocator.
+ * Performing scstrsplit() using a UcxAllocator.
*
- * Read the description of sstrsplit() for details.
+ * Read the description of scstrsplit() for details.
*
* The memory for the sstr_t.ptr pointers of the array items and the memory for
* the sstr_t array itself are allocated by using the UcxAllocator.malloc()
@@ -596,13 +593,13 @@
* @return a sstr_t array containing the split strings or
* NULL
on error
*
- * @see ucx_strsplit()
+ * @see scstrsplit()
*/
-sstr_t* ucx_strsplit_a(UcxAllocator *allocator, scstr_t string, scstr_t delim,
+sstr_t* scstrsplit_a(UcxAllocator *allocator, scstr_t string, scstr_t delim,
ssize_t *count);
/**
- * Alias for ucx_strsplit_a() which automatically casts the arguments.
+ * Alias for scstrsplit_a() which automatically casts the arguments.
*
* @param allocator the UcxAllocator used for allocating memory
* @param string the string to split
@@ -615,7 +612,7 @@
* @see sstrsplit()
*/
#define sstrsplit_a(allocator, string, delim, count) \
- ucx_strsplit_a(allocator, SCSTR(string), SCSTR(delim, count))
+ scstrsplit_a(allocator, SCSTR(string), SCSTR(delim, count))
/**
* Compares two UCX strings with standard memcmp()
.
@@ -629,10 +626,10 @@
* length of s1 is greater than the length of s2 or the result of
* memcmp()
otherwise (i.e. 0 if the strings match)
*/
-int ucx_strcmp(scstr_t s1, scstr_t s2);
+int scstrcmp(scstr_t s1, scstr_t s2);
/**
- * Alias for ucx_strcmp() which automatically casts its arguments.
+ * Alias for scstrcmp() which automatically casts its arguments.
*
* @param s1 the first string
* @param s2 the second string
@@ -640,12 +637,12 @@
* length of s1 is greater than the length of s2 or the result of
* memcmp()
otherwise (i.e. 0 if the strings match)
*/
-#define sstrcmp(s1, s2) ucx_strcmp(SCSTR(s1), SCSTR(s2))
+#define sstrcmp(s1, s2) scstrcmp(SCSTR(s1), SCSTR(s2))
/**
* Compares two UCX strings ignoring the case.
*
- * At first it compares the sstr_t.length attribute of the two strings. If and
+ * At first it compares the scstr_t.length attribute of the two strings. If and
* only if the lengths match, both strings are compared char by char ignoring
* the case.
*
@@ -655,10 +652,10 @@
* length of s1 is greater than the length of s2 or the result of the platform
* specific string comparison function ignoring the case.
*/
-int ucx_strcasecmp(scstr_t s1, scstr_t s2);
+int scstrcasecmp(scstr_t s1, scstr_t s2);
/**
- * Alias for ucx_strcasecmp() which automatically casts the arguments.
+ * Alias for scstrcasecmp() which automatically casts the arguments.
*
* @param s1 the first string
* @param s2 the second string
@@ -666,7 +663,7 @@
* length of s1 is greater than the length of s2 or the result of the platform
* specific string comparison function ignoring the case.
*/
-#define sstrcasecmp(s1, s2) ucx_strcasecmp(SCSTR(s1), SCSTR(s2))
+#define sstrcasecmp(s1, s2) scstrcasecmp(SCSTR(s1), SCSTR(s2))
/**
* Creates a duplicate of the specified string.
@@ -680,26 +677,26 @@
*
* @param string the string to duplicate
* @return a duplicate of the string
- * @see ucx_strdup_a()
+ * @see scstrdup_a()
*/
-sstr_t ucx_strdup(scstr_t string);
+sstr_t scstrdup(scstr_t string);
/**
- * Alias for ucx_strdup() which automatically casts the argument.
+ * Alias for scstrdup() which automatically casts the argument.
*
* @param string the string to duplicate
* @return a duplicate of the string
* @see sstrdup_a()
*/
-#define sstrdup(string) ucx_strdup(SCSTR(string))
+#define sstrdup(string) scstrdup(SCSTR(string))
/**
* Creates a duplicate of the specified string using a UcxAllocator.
*
* The new sstr_t will contain a copy allocated by the allocators
- * ucx_allocator_malloc function. So it is implementation depended, whether the
+ * UcxAllocator.malloc() function. So it is implementation depended, whether the
* returned sstr_t.ptr pointer must be passed to the allocators
- * ucx_allocator_free function manually.
+ * UcxAllocator.free() function manually.
*
* The sstr_t.ptr of the return value will always be NULL
-
* terminated and mutable, regardless of the argument.
@@ -707,19 +704,19 @@
* @param allocator a valid instance of a UcxAllocator
* @param string the string to duplicate
* @return a duplicate of the string
- * @see ucx_strdup()
+ * @see scstrdup()
*/
-sstr_t ucx_strdup_a(UcxAllocator *allocator, scstr_t string);
+sstr_t scstrdup_a(UcxAllocator *allocator, scstr_t string);
/**
- * Alias for ucx_strdup_a() which automatically casts the argument.
+ * Alias for scstrdup_a() which automatically casts the argument.
*
* @param allocator a valid instance of a UcxAllocator
* @param string the string to duplicate
* @return a duplicate of the string
- * @see ucx_strdup()
+ * @see scstrdup()
*/
-#define sstrdup_a(allocator, string) ucx_strdup_a(allocator, SCSTR(string))
+#define sstrdup_a(allocator, string) scstrdup_a(allocator, SCSTR(string))
/**
@@ -766,16 +763,16 @@
* @param prefix the prefix the string should have
* @return 1, if and only if the string has the specified prefix, 0 otherwise
*/
-int ucx_strprefix(scstr_t string, scstr_t prefix);
+int scstrprefix(scstr_t string, scstr_t prefix);
/**
- * Alias for ucx_strprefix() which automatically casts the arguments.
+ * Alias for scstrprefix() which automatically casts the arguments.
*
* @param string the string to check
* @param prefix the prefix the string should have
* @return 1, if and only if the string has the specified prefix, 0 otherwise
*/
-#define sstrprefix(string, prefix) ucx_strprefix(SCSTR(string), SCSTR(prefix))
+#define sstrprefix(string, prefix) scstrprefix(SCSTR(string), SCSTR(prefix))
/**
* Checks, if a string has a specific suffix.
@@ -783,16 +780,16 @@
* @param suffix the suffix the string should have
* @return 1, if and only if the string has the specified suffix, 0 otherwise
*/
-int ucx_strsuffix(scstr_t string, scstr_t suffix);
+int scstrsuffix(scstr_t string, scstr_t suffix);
/**
- * Alias for ucx_strsuffix() which automatically casts the arguments.
+ * Alias for scstrsuffix() which automatically casts the arguments.
*
* @param string the string to check
* @param suffix the suffix the string should have
* @return 1, if and only if the string has the specified suffix, 0 otherwise
*/
-#define sstrsuffix(string, suffix) ucx_strsuffix(SCSTR(string), SCSTR(suffix))
+#define sstrsuffix(string, suffix) scstrsuffix(SCSTR(string), SCSTR(suffix))
/**
* Returns a lower case version of a string.
@@ -804,15 +801,15 @@
* @return the resulting lower case string
* @see scstrdup()
*/
-sstr_t ucx_strlower(scstr_t string);
+sstr_t scstrlower(scstr_t string);
/**
- * Alias for ucx_strlower() which automatically casts the argument.
+ * Alias for scstrlower() which automatically casts the argument.
*
* @param string the input string
* @return the resulting lower case string
*/
-#define sstrlower(string) ucx_strlower(SCSTR(string))
+#define sstrlower(string) scstrlower(SCSTR(string))
/**
* Returns a lower case version of a string.
@@ -825,17 +822,17 @@
* @return the resulting lower case string
* @see scstrdup_a()
*/
-sstr_t ucx_strlower_a(UcxAllocator *allocator, scstr_t string);
+sstr_t scstrlower_a(UcxAllocator *allocator, scstr_t string);
/**
- * Alias for ucx_strlower_a() which automatically casts the argument.
+ * Alias for scstrlower_a() which automatically casts the argument.
*
* @param allocator the allocator used for duplicating the string
* @param string the input string
* @return the resulting lower case string
*/
-#define sstrlower_a(allocator, string) ucx_strlower_a(allocator, SCSTR(string))
+#define sstrlower_a(allocator, string) scstrlower_a(allocator, SCSTR(string))
/**
* Returns a upper case version of a string.
@@ -847,15 +844,15 @@
* @return the resulting upper case string
* @see scstrdup()
*/
-sstr_t ucx_strupper(scstr_t string);
+sstr_t scstrupper(scstr_t string);
/**
- * Alias for ucx_strupper() which automatically casts the argument.
+ * Alias for scstrupper() which automatically casts the argument.
*
* @param string the input string
* @return the resulting upper case string
*/
-#define sstrupper(string) ucx_strupper(SCSTR(string))
+#define sstrupper(string) scstrupper(SCSTR(string))
/**
* Returns a upper case version of a string.
@@ -868,16 +865,16 @@
* @return the resulting upper case string
* @see scstrdup_a()
*/
-sstr_t ucx_strupper_a(UcxAllocator *allocator, scstr_t string);
+sstr_t scstrupper_a(UcxAllocator *allocator, scstr_t string);
/**
- * Alias for ucx_strupper_a() which automatically casts the argument.
+ * Alias for scstrupper_a() which automatically casts the argument.
*
* @param allocator the allocator used for duplicating the string
* @param string the input string
* @return the resulting upper case string
*/
-#define sstrupper_a(allocator, string) ucx_strupper_a(allocator, string)
+#define sstrupper_a(allocator, string) scstrupper_a(allocator, string)
#ifdef __cplusplus
}