aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/wchar/new.c170
1 files changed, 85 insertions, 85 deletions
diff --git a/src/wchar/new.c b/src/wchar/new.c
index da1d254..5e8914d 100644
--- a/src/wchar/new.c
+++ b/src/wchar/new.c
@@ -19,55 +19,6 @@
-wchar_t* (wmemrchr)(const wchar_t* segment, wchar_t c, size_t size) /* slibc+gnu: completeness */
-{
- for (;;)
- if (segment[--size] == c)
- return segment + size;
-}
-
-wchar_t* (rawwmemcasemem)(const wchar_t* haystack, const wchar_t* needle, size_t needle_length) /* slibc: completeness */
-{
- return (wmemcasemem)(haystack, SIZE_MAX, needle, needle_length);
-}
-
-wchar_t* (rawwmemmem)(const wchar_t* haystack, const wchar_t* needle, size_t needle_length) /* slibc: completeness */
-{
- return (wmemmem)(haystack, SIZE_MAX, needle, needle_length);
-}
-
-wchar_t* (wmemccasemem)(const wchar_t* haystack, size_t haystack_length, const wchar_t* needle, size_t needle_length, wchar_t stop) /* slibc: completeness */
-{
- const wchar_t* p = wmemchr(haystack, stop, haystack_length);
- return (wmemcasemem)(haystack, p ? (size_t)(p - haystack) : haystack_length, needle, needle_length);
-}
-
-wchar_t* (wmemcmem)(const wchar_t* haystack, size_t haystack_length, const wchar_t* needle, size_t needle_length, wchar_t stop) /* slibc: completeness */
-{
- const wchar_t* p = wmemchr(haystack, stop, haystack_length);
- return (wmemmem)(haystack, p ? (size_t)(p - haystack) : haystack_length, needle, needle_length);
-}
-
-wchar_t* (wcsccasestr)(const wchar_t* haystack, const wchar_t* needle, wchar_t stop) /* slibc: completeness */
-{
- return (wmemcasemem)(haystack, wscclen(haystack, stop), needle, wsclen(needle));
-}
-
-wchar_t* (wcscstr)(const wchar_t* haystack, const wchar_t* needle, wchar_t stop) /* slibc: completeness */
-{
- return (wmemmem)(haystack, wscclen(haystack, stop), needle, wsclen(needle));
-}
-
-wchar_t* (wcscncasestr)(const wchar_t* haystack, const wchar_t* needle, wchar_t stop, size_t maxlen) /* slibc: completeness */
-{
- return (wmemcasemem)(haystack, wsccnlen(haystack, stop, maxlen), needle, wsclen(needle));
-}
-
-wchar_t* (wcscnstr)(const wchar_t* haystack, const wchar_t* needle, wchar_t stop, size_t maxlen) /* slibc: completeness */
-{
- return (wmemmem)(haystack, wsccnlen(haystack, stop, maxlen), needle, wsclen(needle));
-}
-
size_t wscclen(const wchar_t* string, wchar_t stop) /* slibc: completeness */
{
return (size_t)(wscchrnul(string, stop) - string);
@@ -197,36 +148,53 @@ wchar_t* (wcscnrchr)(const wchar_t* string, wchar_t c, wchar_t stop, size_t maxl
return c ? r : (string - 1);
}
-wchar_t* wcsnsep(wchar_t** restrict string, const wchar_t* restrict delimiters,
- size_t* restrict maxlen) /* slibc: completeness */
+wchar_t* (rawwmemrchr)(const wchar_t* segment, wchar_t c, size_t size) /* slibc+gnu: completeness */
{
- wchar_t* r = *string;
- wchar_t* next;
- if (r == NULL)
- return NULL;
-
- next = wcsnpbrk(r, delimiters, *maxlen);
- if (next != NULL)
- *next++ = 0, *maxlen -= (size_t)(next - r);
- *string = next;
-
- return r;
+ for (;;)
+ if (segment[--size] == c)
+ return segment + size;
}
-wchar_t* wcsntok(wchar_t* restrict string, const wchar_t* restrict delimiters,
- wchar_t** restrict state, size_t* restrict maxlen) /* slibc: completeness */
+wchar_t* (rawwmemcasemem)(const wchar_t* haystack, const wchar_t* needle, size_t needle_length) /* slibc: completeness */
{
- wchar_t* r;
- if (string == NULL)
- *state = string;
- for (;;)
- {
- r = wcsnsep(state, delimiters, maxlen);
- if (r == NULL)
- return NULL;
- if (*r)
- return r;
- }
+ return (wmemcasemem)(haystack, SIZE_MAX, needle, needle_length);
+}
+
+wchar_t* (rawwmemmem)(const wchar_t* haystack, const wchar_t* needle, size_t needle_length) /* slibc: completeness */
+{
+ return (wmemmem)(haystack, SIZE_MAX, needle, needle_length);
+}
+
+wchar_t* (wmemccasemem)(const wchar_t* haystack, size_t haystack_length, const wchar_t* needle, size_t needle_length, wchar_t stop) /* slibc: completeness */
+{
+ const wchar_t* p = wmemchr(haystack, stop, haystack_length);
+ return (wmemcasemem)(haystack, p ? (size_t)(p - haystack) : haystack_length, needle, needle_length);
+}
+
+wchar_t* (wmemcmem)(const wchar_t* haystack, size_t haystack_length, const wchar_t* needle, size_t needle_length, wchar_t stop) /* slibc: completeness */
+{
+ const wchar_t* p = wmemchr(haystack, stop, haystack_length);
+ return (wmemmem)(haystack, p ? (size_t)(p - haystack) : haystack_length, needle, needle_length);
+}
+
+wchar_t* (wcsccasestr)(const wchar_t* haystack, const wchar_t* needle, wchar_t stop) /* slibc: completeness */
+{
+ return (wmemcasemem)(haystack, wscclen(haystack, stop), needle, wsclen(needle));
+}
+
+wchar_t* (wcscstr)(const wchar_t* haystack, const wchar_t* needle, wchar_t stop) /* slibc: completeness */
+{
+ return (wmemmem)(haystack, wscclen(haystack, stop), needle, wsclen(needle));
+}
+
+wchar_t* (wcscncasestr)(const wchar_t* haystack, const wchar_t* needle, wchar_t stop, size_t maxlen) /* slibc: completeness */
+{
+ return (wmemcasemem)(haystack, wsccnlen(haystack, stop, maxlen), needle, wsclen(needle));
+}
+
+wchar_t* (wcscnstr)(const wchar_t* haystack, const wchar_t* needle, wchar_t stop, size_t maxlen) /* slibc: completeness */
+{
+ return (wmemmem)(haystack, wsccnlen(haystack, stop, maxlen), needle, wsclen(needle));
}
wchar_t* (wcspcbrk)(const wchar_t* string, const wchar_t* skipset) /* slibc: completeness */
@@ -235,6 +203,16 @@ wchar_t* (wcspcbrk)(const wchar_t* string, const wchar_t* skipset) /* slibc: com
return *string ? string : NULL;
}
+wchar_t* (wcspbrknul)(const wchar_t* string, const wchar_t* stopset) /* slibc: completeness */
+{
+ return string + wcscspn(string, stopset);
+}
+
+wchar_t* (wcspcbrknul)(const wchar_t* string, const wchar_t* skipset) /* slibc: completeness */
+{
+ return string + wcsspn(string, skipset);
+}
+
wchar_t* (wcsnpbrk)(const wchar_t* string, const wchar_t* stopset, size_t maxlen) /* slibc: completeness */
{
wchar_t s = string;
@@ -249,16 +227,6 @@ wchar_t* (wcsnpcbrk)(const wchar_t* string, const wchar_t* skipset, size_t maxle
return (((size_t)(string - s) < maxlen) && *string) ? string : NULL;
}
-wchar_t* (wcspbrknul)(const wchar_t* string, const wchar_t* stopset) /* slibc: completeness */
-{
- return string + wcscspn(string, stopset);
-}
-
-wchar_t* (wcspcbrknul)(const wchar_t* string, const wchar_t* skipset) /* slibc: completeness */
-{
- return string + wcsspn(string, skipset);
-}
-
wchar_t* (wcsnpbrknul)(const wchar_t* string, const wchar_t* stopset, size_t maxlen) /* slibc: completeness */
{
return string + wcscspn(string, stopset, maxlen);
@@ -294,6 +262,38 @@ size_t wcsncspn(const wchar_t* string, const wchar_t* stopset, size_t maxlen) /*
return end;
}
+wchar_t* wcsnsep(wchar_t** restrict string, const wchar_t* restrict delimiters,
+ size_t* restrict maxlen) /* slibc: completeness */
+{
+ wchar_t* r = *string;
+ wchar_t* next;
+ if (r == NULL)
+ return NULL;
+
+ next = wcsnpbrk(r, delimiters, *maxlen);
+ if (next != NULL)
+ *next++ = 0, *maxlen -= (size_t)(next - r);
+ *string = next;
+
+ return r;
+}
+
+wchar_t* wcsntok(wchar_t* restrict string, const wchar_t* restrict delimiters,
+ wchar_t** restrict state, size_t* restrict maxlen) /* slibc: completeness */
+{
+ wchar_t* r;
+ if (string == NULL)
+ *state = string;
+ for (;;)
+ {
+ r = wcsnsep(state, delimiters, maxlen);
+ if (r == NULL)
+ return NULL;
+ if (*r)
+ return r;
+ }
+}
+
wchar_t* (wcsprbrk)(const wchar_t* string, const wchar_t* stopset) /* slibc: completeness */
{
wchar_t* r;