summaryrefslogtreecommitdiffstats
path: root/include/c/mem/mem/memmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/c/mem/mem/memmem.h')
-rw-r--r--include/c/mem/mem/memmem.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/c/mem/mem/memmem.h b/include/c/mem/mem/memmem.h
new file mode 100644
index 0000000..7811492
--- /dev/null
+++ b/include/c/mem/mem/memmem.h
@@ -0,0 +1,31 @@
+// Copyright 2022 Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: LGPL-3.0-or-later WITH LGPL-3.0-linking-exception
+
+
+#ifndef INCLUDE_C_STP_MEM_MEM_MEMMEM_H_
+#define INCLUDE_C_STP_MEM_MEM_MEMMEM_H_
+
+
+#include <stddef.h>
+#include <string.h>
+
+#include <c/qual/const/const.h>
+
+
+#define c_memmem(h, hsz, n, nsz) c_const_generic_func(c_memmem, h, hsz, n, nsz)
+
+
+#pragma clang assume_nonnull begin
+inline const void *(c_memmem)(const void *haystack, size_t hsize,
+ const void *needle, size_t nsize);
+
+
+inline const void *
+(c_memmem)(const void *haystack, size_t hsize, const void *needle, size_t nsize)
+{
+ return memmem(haystack, hsize, needle, nsize);
+}
+#pragma clang assume_nonnull end
+
+
+#endif // Header guard