aboutsummaryrefslogtreecommitdiffstats
path: root/src/string
diff options
context:
space:
mode:
Diffstat (limited to 'src/string')
-rw-r--r--src/string/memccpy.c8
-rw-r--r--src/string/strchr.c12
-rw-r--r--src/string/strspn.c2
-rw-r--r--src/string/strstr.c52
4 files changed, 37 insertions, 37 deletions
diff --git a/src/string/memccpy.c b/src/string/memccpy.c
index 4212419..0c73f8b 100644
--- a/src/string/memccpy.c
+++ b/src/string/memccpy.c
@@ -33,9 +33,9 @@
* number of copied characters; the address of
* one character passed the last written character.
*/
-void* memccpy(void* restrict whither, const void* restrict whence, int c, size_t size)
+void* (memccpy)(void* restrict whither, const void* restrict whence, int c, size_t size)
{
- char* stop = memchr(whence, c, size);
+ char* stop = (memchr)(whence, c, size);
void* r = NULL;
if (stop != NULL)
size = (size_t)(stop - (const char*)whence), r = whither + size;
@@ -60,9 +60,9 @@ void* memccpy(void* restrict whither, const void* restrict whence, int c, size_t
* number of copied characters; the address of
* one character passed the last written character.
*/
-void* memcmove(void* whither, const void* whence, int c, size_t size)
+void* (memcmove)(void* whither, const void* whence, int c, size_t size)
{
- char* stop = memchr(whence, c, size);
+ char* stop = (memchr)(whence, c, size);
void* r = NULL;
if (stop != NULL)
size = (size_t)(stop - (const char*)whence), r = whither + size;
diff --git a/src/string/strchr.c b/src/string/strchr.c
index bf79a0b..06f3ee6 100644
--- a/src/string/strchr.c
+++ b/src/string/strchr.c
@@ -31,7 +31,7 @@
* @return Pointer to the first occurrence of `c`,
* `NULL` if none were found.
*/
-void* memchr(const void* segment, int c, size_t size)
+void* (memchr)(const void* segment, int c, size_t size)
{
char* s = segment;
while (size--)
@@ -51,7 +51,7 @@ void* memchr(const void* segment, int c, size_t size)
* @param c The sought after character.
* @return Pointer to the first occurrence of `c`.
*/
-void* rawmemchr(const void* segment, int c)
+void* (rawmemchr)(const void* segment, int c)
{
char* s = segment;
for (;;)
@@ -73,7 +73,7 @@ void* rawmemchr(const void* segment, int c)
* @return Pointer to the last occurrence of `c`,
* `NULL` if none were found.
*/
-void* memrchr(const void* segment, int c, size_t size)
+void* (memrchr)(const void* segment, int c, size_t size)
{
char* s = segment;
while (size--)
@@ -96,7 +96,7 @@ void* memrchr(const void* segment, int c, size_t size)
* @return Pointer to the first occurrence of `c`,
* `NULL` if none were found.
*/
-char* strchr(const char* string, int c)
+char* (strchr)(const char* string, int c)
{
for (;;)
if (*string == c)
@@ -120,7 +120,7 @@ char* strchr(const char* string, int c)
* Pointer to the terminating NUL character
* if none were found.
*/
-char* strchrnul(const char* string, int c)
+char* (strchrnul)(const char* string, int c)
{
for (;; string++)
if (*string == c)
@@ -144,7 +144,7 @@ char* strchrnul(const char* string, int c)
* @return Pointer to the last occurrence of `c`,
* `NULL` if none were found.
*/
-char* strrchr(const char* string, int c)
+char* (strrchr)(const char* string, int c)
{
char* r = NULL;
for (;;)
diff --git a/src/string/strspn.c b/src/string/strspn.c
index f8d1dac..511a4bc 100644
--- a/src/string/strspn.c
+++ b/src/string/strspn.c
@@ -82,7 +82,7 @@ size_t strcspn(const char* string, const char* stopset)
* `string` of a byte found in `stopset`.
* `NULL` is returned if none is found.
*/
-char* strpbrk(const char* string, const char* stopset)
+char* (strpbrk)(const char* string, const char* stopset)
{
char set[256];
char c;
diff --git a/src/string/strstr.c b/src/string/strstr.c
index 34b3120..a2c31f6 100644
--- a/src/string/strstr.c
+++ b/src/string/strstr.c
@@ -35,9 +35,9 @@
* @return Pointer to the first occurrence of the
* substring, `NULL` if not found.
*/
-char* strstr(const char* haystack, const char* needle)
+char* (strstr)(const char* haystack, const char* needle)
{
- return memmem(haystack, strlen(haystack), needle, strlen(needle));
+ return (memmem)(haystack, strlen(haystack), needle, strlen(needle));
}
@@ -50,9 +50,9 @@ char* strstr(const char* haystack, const char* needle)
* @return Pointer to the first occurrence of the
* substring, `NULL` if not found.
*/
-char* strcasestr(const char* haystack, const char* needle)
+char* (strcasestr)(const char* haystack, const char* needle)
{
- return memcasemem(haystack, strlen(haystack), needle, strlen(needle));
+ return (memcasemem)(haystack, strlen(haystack), needle, strlen(needle));
}
@@ -69,9 +69,9 @@ char* strcasestr(const char* haystack, const char* needle)
* @return Pointer to the first occurrence of the
* substring, `NULL` if not found.
*/
-char* strnstr(const char* haystack, const char* needle, size_t maxlen)
+char* (strnstr)(const char* haystack, const char* needle, size_t maxlen)
{
- return memmem(haystack, strnlen(haystack, maxlen), needle, strlen(needle));
+ return (memmem)(haystack, strnlen(haystack, maxlen), needle, strlen(needle));
}
@@ -87,9 +87,9 @@ char* strnstr(const char* haystack, const char* needle, size_t maxlen)
* @return Pointer to the first occurrence of the
* substring, `NULL` if not found.
*/
-char* strncasestr(const char* haystack, const char* needle, size_t maxlen)
+char* (strncasestr)(const char* haystack, const char* needle, size_t maxlen)
{
- return memcasemem(haystack, strnlen(haystack, maxlen), needle, strlen(needle));
+ return (memcasemem)(haystack, strnlen(haystack, maxlen), needle, strlen(needle));
}
@@ -104,9 +104,9 @@ char* strncasestr(const char* haystack, const char* needle, size_t maxlen)
* @param needle The sought after substring.
* @return Pointer to the first occurrence of the substring.
*/
-char* rawstrstr(const char* haystack, const char* needle)
+char* (rawstrstr)(const char* haystack, const char* needle)
{
- return memmem(haystack, SIZE_MAX, needle, strlen(needle));
+ return (memmem)(haystack, SIZE_MAX, needle, strlen(needle));
}
@@ -121,9 +121,9 @@ char* rawstrstr(const char* haystack, const char* needle)
* @param needle The sought after substring.
* @return Pointer to the first occurrence of the substring.
*/
-char* rawstrcasestr(const char* haystack, const char* needle)
+char* (rawstrcasestr)(const char* haystack, const char* needle)
{
- return memcasemem(haystack, SIZE_MAX, needle, strlen(needle));
+ return (memcasemem)(haystack, SIZE_MAX, needle, strlen(needle));
}
@@ -141,15 +141,15 @@ char* rawstrcasestr(const char* haystack, const char* needle)
* @return Pointer to the first occurrence of
* the substring, `NULL` if not found.
*/
-void* memmem(const void* __haystack, size_t haystack_length,
- const void* __needle, size_t needle_length)
+void* (memmem)(const void* __haystack, size_t haystack_length,
+ const void* __needle, size_t needle_length)
{
const char* haystack = __haystack;
const char* needle = __needle;
if (haystack_length < needle_length)
return NULL;
if (haystack_length == needle_length)
- return !memcmp(haystack, needle, haystack_length) ? haystack : NULL;
+ return !(memcmp)(haystack, needle, haystack_length) ? haystack : NULL;
#include "substring.h"
}
@@ -168,15 +168,15 @@ void* memmem(const void* __haystack, size_t haystack_length,
* @return Pointer to the first occurrence of
* the substring, `NULL` if not found.
*/
-void* memcasemem(const void* __haystack, size_t haystack_length,
- const void* __needle, size_t needle_length)
+void* (memcasemem)(const void* __haystack, size_t haystack_length,
+ const void* __needle, size_t needle_length)
{
const char* haystack = __haystack;
const char* needle = __needle;
if (haystack_length < needle_length)
return NULL;
if (haystack_length == needle_length)
- return !memcasecmp(haystack, needle, haystack_length) ? haystack : NULL;
+ return !(memcasecmp)(haystack, needle, haystack_length) ? haystack : NULL;
#define CASE
#include "substring.h"
#undef CASE
@@ -194,13 +194,13 @@ void* memcasemem(const void* __haystack, size_t haystack_length,
* @return `string` if `string` begins with
* `desired`, `NULL` otherwise.
*/
-char* strstarts(const char* string, const char* desired)
+char* (strstarts)(const char* string, const char* desired)
{
size_t n = strlen(string);
size_t m = strlen(desired);
if (n < m)
return NULL;
- return memcmp(string, desired, m) ? NULL : string;
+ return (memcmp)(string, desired, m) ? NULL : string;
}
@@ -215,13 +215,13 @@ char* strstarts(const char* string, const char* desired)
* @return The `string`, where `desired` beings if
* `string` ends with `desired`, `NULL` otherwise.
*/
-char* strends(const char* string, const char* desired)
+char* (strends)(const char* string, const char* desired)
{
size_t n = strlen(string);
size_t m = strlen(desired);
if (n < m)
return NULL;
- return memcmp(string + (n - m), desired, m) ? NULL : (string + n);
+ return (memcmp)(string + (n - m), desired, m) ? NULL : (string + n);
}
@@ -236,13 +236,13 @@ char* strends(const char* string, const char* desired)
* @return `string` if `string` begins with
* `desired`, `NULL` otherwise.
*/
-char* strcasestarts(const char* string, const char* desired)
+char* (strcasestarts)(const char* string, const char* desired)
{
size_t n = strlen(string);
size_t m = strlen(desired);
if (n < m)
return NULL;
- return memcasecmp(string, desired, m) ? NULL : string;
+ return (memcasecmp)(string, desired, m) ? NULL : string;
}
@@ -257,12 +257,12 @@ char* strcasestarts(const char* string, const char* desired)
* @return The `string`, where `desired` beings if
* `string` ends with `desired`, `NULL` otherwise.
*/
-char* strcaseends(const char* string, const char* desired)
+char* (strcaseends)(const char* string, const char* desired)
{
size_t n = strlen(string);
size_t m = strlen(desired);
if (n < m)
return NULL;
- return memcasecmp(string + (n - m), desired, m) ? NULL : (string + n);
+ return (memcasecmp)(string + (n - m), desired, m) ? NULL : (string + n);
}