aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-09-01 21:07:54 +0200
committerMattias Andrée <maandree@operamail.com>2015-09-01 21:07:54 +0200
commitac044784a6ce64ff15610d4b70750065a7f01b80 (patch)
tree8ac8629c0089099f21be9107a5d3779963d33ca0 /src
parentadd memfrob (diff)
downloadslibc-ac044784a6ce64ff15610d4b70750065a7f01b80.tar.gz
slibc-ac044784a6ce64ff15610d4b70750065a7f01b80.tar.bz2
slibc-ac044784a6ce64ff15610d4b70750065a7f01b80.tar.xz
start on makefile and fixing warnings and errors
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/errno.c51
-rw-r--r--src/string/memccpy.c12
-rw-r--r--src/string/memcpy.c10
-rw-r--r--src/string/memfrob.c1
-rw-r--r--src/string/strcat.c1
-rw-r--r--src/string/strchr.c19
-rw-r--r--src/string/strcmp.c1
-rw-r--r--src/string/strcpy.c3
-rw-r--r--src/string/strdup.c1
-rw-r--r--src/string/strerror.c2
-rw-r--r--src/string/strfry.c5
-rw-r--r--src/string/strlen.c1
-rw-r--r--src/string/strmove.c3
-rw-r--r--src/string/strspn.c8
-rw-r--r--src/string/strstr.c1
-rw-r--r--src/string/strtok.c3
-rw-r--r--src/strings/bzero.c2
-rw-r--r--src/wchar/wcscat.c3
-rw-r--r--src/wchar/wcschr.c4
-rw-r--r--src/wchar/wcscmp.c1
-rw-r--r--src/wchar/wcscpy.c17
-rw-r--r--src/wchar/wcsdup.c1
-rw-r--r--src/wchar/wcslen.c1
-rw-r--r--src/wchar/wcsmove.c15
-rw-r--r--src/wchar/wcsspn.c6
-rw-r--r--src/wchar/wcsstr.c1
-rw-r--r--src/wchar/wcstok.c3
-rw-r--r--src/wchar/wmemccpy.c8
-rw-r--r--src/wchar/wmemset.c2
29 files changed, 119 insertions, 67 deletions
diff --git a/src/errno.c b/src/errno.c
new file mode 100644
index 0000000..80b46fe
--- /dev/null
+++ b/src/errno.c
@@ -0,0 +1,51 @@
+/**
+ * slibc — Yet another C library
+ * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include <errno.h>
+
+
+
+/**
+ * This is the name that was used to invoke the program
+ * running in the current process. This is the value
+ * of `argv[0]` from the `main` function (where `argv`
+ * is the second parameter). If `argc` is zero, this
+ * variable will have the value `NULL`. This is not
+ * necessarily a proper comman name. For example,
+ * login shells are usually prefixes with a dash,
+ * for example "-bash", despite that there is no such
+ * command. Often, but not always, this will not contain
+ * directory.
+ *
+ * This string may be edited if `program_invocation_short_name`
+ * or `argv[0]` is edited.
+ *
+ * This is a GNU and slibc extension.
+ */
+char* program_invocation_name = NULL;
+
+/**
+ * Variant of `program_invocation_name` that is
+ * guaranteed to not include the directory.
+ *
+ * This string may be edited if `program_invocation_name`
+ * or `argv[0]` is edited.
+ *
+ * This is a GNU extension.
+ */
+char* program_invocation_short_name = NULL;
+
diff --git a/src/string/memccpy.c b/src/string/memccpy.c
index 85378d9..4212419 100644
--- a/src/string/memccpy.c
+++ b/src/string/memccpy.c
@@ -35,10 +35,10 @@
*/
void* memccpy(void* restrict whither, const void* restrict whence, int c, size_t size)
{
- char_t* stop = memchr(whence, c, size);
- void* r = NULL
+ char* stop = memchr(whence, c, size);
+ void* r = NULL;
if (stop != NULL)
- size = (size_t)(stop - whence), r = whither + size;
+ size = (size_t)(stop - (const char*)whence), r = whither + size;
memcpy(whither, whence, size);
return r;
}
@@ -62,10 +62,10 @@ void* memccpy(void* restrict whither, const void* restrict whence, int c, size_t
*/
void* memcmove(void* whither, const void* whence, int c, size_t size)
{
- char_t* stop = memchr(whence, c, size);
- void* r = NULL
+ char* stop = memchr(whence, c, size);
+ void* r = NULL;
if (stop != NULL)
- size = (size_t)(stop - whence), r = whither + size;
+ size = (size_t)(stop - (const char*)whence), r = whither + size;
memmove(whither, whence, size);
return r;
}
diff --git a/src/string/memcpy.c b/src/string/memcpy.c
index 4582544..02479cd 100644
--- a/src/string/memcpy.c
+++ b/src/string/memcpy.c
@@ -18,6 +18,9 @@
#include <string.h>
+# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
+
+
/**
* Copy a memory segment to another, non-overlapping, segment.
@@ -30,10 +33,11 @@
void* memcpy(void* restrict whither, const void* restrict whence, size_t size)
{
/* TODO improve implementation of memcpy */
- void* r = whither;
+ char* d = whither;
+ char* s = whence;
while (size--)
- *whither++ = *whence++;
- return r;
+ *d++ = *s++;
+ return whither;
}
diff --git a/src/string/memfrob.c b/src/string/memfrob.c
index e43496a..7ec9abd 100644
--- a/src/string/memfrob.c
+++ b/src/string/memfrob.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
diff --git a/src/string/strcat.c b/src/string/strcat.c
index ed10cc2..2205f39 100644
--- a/src/string/strcat.c
+++ b/src/string/strcat.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
diff --git a/src/string/strchr.c b/src/string/strchr.c
index 21345d4..2b49c2e 100644
--- a/src/string/strchr.c
+++ b/src/string/strchr.c
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
+
+
+# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
@@ -31,9 +33,10 @@
*/
void* memchr(const void* segment, int c, size_t size)
{
+ char* s = segment;
while (size--)
- if (*segment++ == c)
- return segment - 1;
+ if (*s++ == c)
+ return s - 1;
return NULL;
}
@@ -50,9 +53,10 @@ void* memchr(const void* segment, int c, size_t size)
*/
void* rawmemchr(const void* segment, int c)
{
+ char* s = segment;
for (;;)
- if (*segment++ == c)
- return segment - 1;
+ if (*s++ == c)
+ return s - 1;
}
@@ -71,9 +75,10 @@ void* rawmemchr(const void* segment, int c)
*/
void* memrchr(const void* segment, int c, size_t size)
{
+ char* s = segment;
while (size--)
- if (segment[size] == c)
- return segment + size;
+ if (s[size] == c)
+ return s + size;
return NULL;
}
diff --git a/src/string/strcmp.c b/src/string/strcmp.c
index 966bb06..f626f91 100644
--- a/src/string/strcmp.c
+++ b/src/string/strcmp.c
@@ -17,7 +17,6 @@
*/
#include <string.h>
#include <strings.h>
-#include <stddef.h>
#include <inttypes.h>
#include <ctype.h>
diff --git a/src/string/strcpy.c b/src/string/strcpy.c
index dfbdc75..17dd339 100644
--- a/src/string/strcpy.c
+++ b/src/string/strcpy.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
@@ -93,7 +92,7 @@ char* strstrcpy(char* restrict whither, const char* restrict whence, const char*
{
const char* stop = str == NULL ? NULL : strstr(whence, str);
size_t n = stop == NULL ? strlen(whence) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL ? whither + n;
+ char* r = stop == NULL ? NULL : (whither + n);
memcpy(whither, whence, n);
whither[n] = 0;
return r;
diff --git a/src/string/strdup.c b/src/string/strdup.c
index c65970e..c23548b 100644
--- a/src/string/strdup.c
+++ b/src/string/strdup.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
diff --git a/src/string/strerror.c b/src/string/strerror.c
index 7366f63..87f3261 100644
--- a/src/string/strerror.c
+++ b/src/string/strerror.c
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
+#include <errno.h>
diff --git a/src/string/strfry.c b/src/string/strfry.c
index f020202..cf8d643 100644
--- a/src/string/strfry.c
+++ b/src/string/strfry.c
@@ -34,13 +34,16 @@
char* strfry(char* anagram)
{
size_t i, j;
+ int r;
char t;
if (anagram == NULL)
return NULL;
for (i = strlen(anagram); --i;)
{
- j = (int)((double)rand() / (RAND_MAX + 1));
+ r = rand();
+ j = (int)((double)r / (RAND_MAX + 1));
t = anagram[i], anagram[i] = anagram[j], anagram[j] = t;
}
+ return anagram;
}
diff --git a/src/string/strlen.c b/src/string/strlen.c
index 7023cc0..7a08fa0 100644
--- a/src/string/strlen.c
+++ b/src/string/strlen.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
diff --git a/src/string/strmove.c b/src/string/strmove.c
index 86298cf..596822a 100644
--- a/src/string/strmove.c
+++ b/src/string/strmove.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
@@ -97,7 +96,7 @@ char* strstrmove(char* whither, const char* whence, const char* restrict str)
{
const char* stop = str == NULL ? NULL : strstr(whence, str);
size_t n = stop == NULL ? strlen(whence) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL ? whither + n;
+ char* r = stop == NULL ? NULL : (whither + n);
memmove(whither, whence, n);
whither[n] = 0;
return r;
diff --git a/src/string/strspn.c b/src/string/strspn.c
index cf82529..3facfd8 100644
--- a/src/string/strspn.c
+++ b/src/string/strspn.c
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
+
+
+# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
@@ -59,7 +61,7 @@ size_t strcspn(const char* string, const char* stopset)
char c;
const char* s = string;
memset(set, 0, 256);
- while ((c = *skipset++))
+ while ((c = *stopset++))
set[(size_t)c] = 1;
while ((c = *s++))
if (!set[(size_t)c])
@@ -86,7 +88,7 @@ char* stpbrk(const char* string, const char* stopset)
char c;
const char* s = string;
memset(set, 0, 256);
- while ((c = *skipset++))
+ while ((c = *stopset++))
set[(size_t)c] = 1;
while ((c = *s++))
if (!set[(size_t)c])
diff --git a/src/string/strstr.c b/src/string/strstr.c
index a7e490a..68cc647 100644
--- a/src/string/strstr.c
+++ b/src/string/strstr.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
#include <inttypes.h>
diff --git a/src/string/strtok.c b/src/string/strtok.c
index 04668fc..1520431 100644
--- a/src/string/strtok.c
+++ b/src/string/strtok.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
-#include <stddef.h>
@@ -102,7 +101,7 @@ char* strsep(char** restrict string, const char* restrict delimiters)
if (r == NULL)
return NULL;
- next = stpbrk(string, delimiters);
+ next = stpbrk(r, delimiters);
if (next != NULL)
*next++ = 0;
*string = next;
diff --git a/src/strings/bzero.c b/src/strings/bzero.c
index ab7a5f8..4be0948 100644
--- a/src/strings/bzero.c
+++ b/src/strings/bzero.c
@@ -23,7 +23,7 @@
/**
* `memset`, except calls to it cannot be removed by the compiler.
*/
-void* (volatile *__slibc_explicit_memset)(void*, int, size_t) = memset;
+void* (*volatile __slibc_explicit_memset)(void*, int, size_t) = memset;
diff --git a/src/wchar/wcscat.c b/src/wchar/wcscat.c
index c7b1c5e..491f9b7 100644
--- a/src/wchar/wcscat.c
+++ b/src/wchar/wcscat.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
@@ -55,7 +54,7 @@ wchar_t* wcscat(wchar_t* restrict whither, const wchar_t* restrict whence)
*/
wchar_t* wcsncat(wchar_t* restrict whither, const wchar_t* restrict whence, size_t maxlen)
{
- wcsncpy(whither + wcslen(whither), whence, laxmen);
+ wcsncpy(whither + wcslen(whither), whence, maxlen);
return whither;
}
diff --git a/src/wchar/wcschr.c b/src/wchar/wcschr.c
index 493f0a7..16ecac2 100644
--- a/src/wchar/wcschr.c
+++ b/src/wchar/wcschr.c
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
+
+
+# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
diff --git a/src/wchar/wcscmp.c b/src/wchar/wcscmp.c
index ebac2df..c9d1180 100644
--- a/src/wchar/wcscmp.c
+++ b/src/wchar/wcscmp.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
#include <inttypes.h>
#include <wctype.h>
diff --git a/src/wchar/wcscpy.c b/src/wchar/wcscpy.c
index 7d75a98..37b8ed4 100644
--- a/src/wchar/wcscpy.c
+++ b/src/wchar/wcscpy.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
@@ -67,9 +66,9 @@ wchar_t* wcpcpy(wchar_t* restrict whither, const wchar_t* restrict whence)
* one character passed the last written non-NUL
* character.
*/
-wchar_t* wcsccpy(wchar_t* restrict whither, const wchar_t* restrict whence, wchat_t c)
+wchar_t* wcsccpy(wchar_t* restrict whither, const wchar_t* restrict whence, wchar_t c)
{
- wchar_t* r = wmemccopy(whither, whence, c, wcslen(whence) + 1);
+ wchar_t* r = wmemccpy(whither, whence, c, wcslen(whence) + 1);
if (r)
*r = 0;
return r;
@@ -96,7 +95,7 @@ wchar_t* wcswcscpy(wchar_t* restrict whither, const wchar_t* restrict whence, co
{
const wchar_t* stop = str == NULL ? NULL : wcsstr(whence, str);
size_t n = stop == NULL ? wcslen(whence) : (size_t)(stop - whence);
- wchar_t* r = stop == NULL ? NULL ? whither + n;
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemcpy(whither, whence, n);
whither[n] = 0;
return r;
@@ -176,11 +175,11 @@ wchar_t* wcpncpy(wchar_t* restrict whither, const wchar_t* restrict whence, size
* one character passed the last written non-NUL
* character.
*/
-wchar_t* wcscncpy(wchar_t* restrict whither, const wchar_t* restrict whence, wchat_t c, size_t maxlen)
+wchar_t* wcscncpy(wchar_t* restrict whither, const wchar_t* restrict whence, wchar_t c, size_t maxlen)
{
- const char* stop = wmemchr(whence, c, maxlen);
+ const wchar_t* stop = wmemchr(whence, c, maxlen);
size_t n = stop == NULL ? wcsnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemcpy(whither, whence, n);
wmemset(whither, 0, maxlen - n);
return r;
@@ -213,9 +212,9 @@ wchar_t* wcscncpy(wchar_t* restrict whither, const wchar_t* restrict whence, wch
wchar_t* wcswcsncpy(wchar_t* restrict whither, const wchar_t* restrict whence,
const wchar_t* restrict str, size_t maxlen)
{
- const char* stop = wcsnstr(whence, str, maxlen);
+ const wchar_t* stop = wcsnstr(whence, str, maxlen);
size_t n = stop == NULL ? wcsnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemcpy(whither, whence, n);
wmemset(whither, 0, maxlen - n);
return r;
diff --git a/src/wchar/wcsdup.c b/src/wchar/wcsdup.c
index dbbbb4c..37b57f9 100644
--- a/src/wchar/wcsdup.c
+++ b/src/wchar/wcsdup.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
diff --git a/src/wchar/wcslen.c b/src/wchar/wcslen.c
index ad81227..b4a07c6 100644
--- a/src/wchar/wcslen.c
+++ b/src/wchar/wcslen.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
diff --git a/src/wchar/wcsmove.c b/src/wchar/wcsmove.c
index c84e4ee..bf86928 100644
--- a/src/wchar/wcsmove.c
+++ b/src/wchar/wcsmove.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
@@ -69,7 +68,7 @@ wchar_t* wcpmove(wchar_t* whither, const wchar_t* whence)
* one character passed the last written non-NUL
* character.
*/
-wchar_t* wcscmove(wchar_t* whither, const wchar_t* whence, wchat_t c)
+wchar_t* wcscmove(wchar_t* whither, const wchar_t* whence, wchar_t c)
{
wchar_t* r = wmemcmove(whither, whence, c, wcslen(whence) + 1);
if (r)
@@ -98,7 +97,7 @@ wchar_t* wcswcsmove(wchar_t* whither, const wchar_t* whence, const wchar_t* rest
{
const wchar_t* stop = str == NULL ? NULL : wcsstr(whence, str);
size_t n = stop == NULL ? wcslen(whence) : (size_t)(stop - whence);
- wchar_t* r = stop == NULL ? NULL ? whither + n;
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemmove(whither, whence, n);
whither[n] = 0;
return r;
@@ -179,11 +178,11 @@ wchar_t* wcpnmove(wchar_t* whither, const wchar_t* whence, size_t maxlen)
* one character passed the last written non-NUL
* character.
*/
-wchar_t* wcscnmove(wchar_t* whither, const wchar_t* whence, wchat_t c, size_t maxlen)
+wchar_t* wcscnmove(wchar_t* whither, const wchar_t* whence, wchar_t c, size_t maxlen)
{
- const char* stop = wmemchr(whence, c, maxlen);
+ const wchar_t* stop = wmemchr(whence, c, maxlen);
size_t n = stop == NULL ? wcsnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemmove(whither, whence, n);
wmemset(whither, 0, maxlen - n);
return r;
@@ -215,9 +214,9 @@ wchar_t* wcscnmove(wchar_t* whither, const wchar_t* whence, wchat_t c, size_t ma
*/
wchar_t* wcswcsnmove(wchar_t* whither, const wchar_t* whence, const wchar_t* restrict str, size_t maxlen)
{
- const char* stop = wcsnstr(whence, str, maxlen);
+ const wchar_t* stop = wcsnstr(whence, str, maxlen);
size_t n = stop == NULL ? wcsnlen(whence, maxlen) : (size_t)(stop - whence);
- char* r = stop == NULL ? NULL : (whither + n);
+ wchar_t* r = stop == NULL ? NULL : (whither + n);
wmemmove(whither, whence, n);
wmemset(whither, 0, maxlen - n);
return r;
diff --git a/src/wchar/wcsspn.c b/src/wchar/wcsspn.c
index 360ab5f..d0ce908 100644
--- a/src/wchar/wcsspn.c
+++ b/src/wchar/wcsspn.c
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
+
+
+# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
@@ -54,7 +56,7 @@ size_t wcscspn(const wchar_t* string, const wchar_t* stopset)
size_t end = wcslen(string);
wchar_t* p;
wchar_t c;
- while ((c = *skipset++))
+ while ((c = *stopset++))
if (p = wcsnchr(string, c, end), p != NULL)
end = (size_t)(p - string);
return end;
diff --git a/src/wchar/wcsstr.c b/src/wchar/wcsstr.c
index bba7d96..0ae7b71 100644
--- a/src/wchar/wcsstr.c
+++ b/src/wchar/wcsstr.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
#include <inttypes.h>
#define WIDE
diff --git a/src/wchar/wcstok.c b/src/wchar/wcstok.c
index 1598d07..2694dc0 100644
--- a/src/wchar/wcstok.c
+++ b/src/wchar/wcstok.c
@@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wchar.h>
-#include <stddef.h>
@@ -80,7 +79,7 @@ wchar_t* wcssep(wchar_t** restrict string, const wchar_t* restrict delimiters)
if (r == NULL)
return NULL;
- next = wcpbrk(string, delimiters);
+ next = wcpbrk(r, delimiters);
if (next != NULL)
*next++ = 0;
*string = next;
diff --git a/src/wchar/wmemccpy.c b/src/wchar/wmemccpy.c
index fbabe0b..cde1a6a 100644
--- a/src/wchar/wmemccpy.c
+++ b/src/wchar/wmemccpy.c
@@ -38,10 +38,10 @@
wchar_t* wmemccpy(wchar_t* restrict whither, const wchar_t* restrict whence, wchar_t c, size_t size)
{
wchar_t* stop = wmemchr(whence, c, size);
- wchar_t* r = NULL
+ wchar_t* r = NULL;
if (stop != NULL)
size = (size_t)(stop - whence), r = whither + size;
- memcpy(whither, whence, size);
+ wmemcpy(whither, whence, size);
return r;
}
@@ -65,10 +65,10 @@ wchar_t* wmemccpy(wchar_t* restrict whither, const wchar_t* restrict whence, wch
wchar_t* wmemcmove(wchar_t* whither, const wchar_t* whence, wchar_t c, size_t size)
{
wchar_t* stop = wmemchr(whence, c, size);
- wchar_t* r = NULL
+ wchar_t* r = NULL;
if (stop != NULL)
size = (size_t)(stop - whence), r = whither + size;
- memmove(whither, whence, size);
+ wmemmove(whither, whence, size);
return r;
}
diff --git a/src/wchar/wmemset.c b/src/wchar/wmemset.c
index 2a60b45..95ec70f 100644
--- a/src/wchar/wmemset.c
+++ b/src/wchar/wmemset.c
@@ -27,7 +27,7 @@
* @param size The number of wide characters in the memory segment.
* @return `segment` is returned.
*/
-wchar_t* wmemset(wchar_t* segment, wchar_t c, size_t size);
+wchar_t* wmemset(wchar_t* segment, wchar_t c, size_t size)
{
wchar_t* r = segment;
while (size--)