aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-11-18 07:48:53 +0100
committerMattias Andrée <maandree@operamail.com>2015-11-18 07:48:53 +0100
commit1a79275b9ba72597e7e3a52d977cc6ce3e4ad089 (patch)
tree0c5b55a987baef90288a8e35cd5c3ea96517848e /src
parenttypo (diff)
downloadslibc-1a79275b9ba72597e7e3a52d977cc6ce3e4ad089.tar.gz
slibc-1a79275b9ba72597e7e3a52d977cc6ce3e4ad089.tar.bz2
slibc-1a79275b9ba72597e7e3a52d977cc6ce3e4ad089.tar.xz
add memmemmove, memmemcpy, wmemmemmove, and wmemmemcpy
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/string/new.c22
-rw-r--r--src/wchar/new.c22
2 files changed, 44 insertions, 0 deletions
diff --git a/src/string/new.c b/src/string/new.c
index 2434659..6c035e0 100644
--- a/src/string/new.c
+++ b/src/string/new.c
@@ -416,3 +416,25 @@ char* (strnprcbrk)(const char* string, const char* skipset, size_t maxlen) /* sl
return r;
}
+char* memmemmove(char* whither, const char* whence, const char* restrict str,
+ size_t strsize, size_t size) /* slibc: completeness */
+{
+ char* stop = (memmem)(whence, size, str, strsize);
+ void* r = NULL;
+ if (stop != NULL)
+ size = (size_t)(stop - (const char*)whence), r = whither + size;
+ memmove(whither, whence, size);
+ return r;
+}
+
+char* memmemcpy(void* whither, const void* whence, const char* restrict str,
+ size_t strsize, size_t size) /* slibc: completeness */
+{
+ char* stop = (memmem)(whence, size, str, strsize);
+ void* r = NULL;
+ if (stop != NULL)
+ size = (size_t)(stop - (const char*)whence), r = whither + size;
+ memcpy(whither, whence, size);
+ return r;
+}
+
diff --git a/src/wchar/new.c b/src/wchar/new.c
index 3f76087..f1ee58c 100644
--- a/src/wchar/new.c
+++ b/src/wchar/new.c
@@ -334,3 +334,25 @@ wchar_t* (wcsnprcbrk)(const wchar_t* string, const wchar_t* skipset, size_t maxl
return found ? string : NULL;
}
+wchar_t* wmemmemmove(wchar_t* whither, const wchar_t* whence, const wchar_t* restrict str,
+ size_t strsize, size_t size) /* slibc: completeness */
+{
+ wchar_t* stop = (wmemmem)(whence, size, str, strsize);
+ wchar_t* r = NULL;
+ if (stop != NULL)
+ size = (size_t)(stop - whence), r = whither + size;
+ wmemmove(whither, whence, size);
+ return r;
+}
+
+char* wmemmemcpy(wchar_t* whither, const wchar_t* whence, const wchar_t* restrict str,
+ size_t strsize, size_t size) /* slibc: completeness */
+{
+ wchar_t* stop = (wmemmem)(whence, size, str, strsize);
+ wchar_t* r = NULL;
+ if (stop != NULL)
+ size = (size_t)(stop - whence), r = whither + size;
+ wmemcpy(whither, whence, size);
+ return r;
+}
+