Commit 992931f0 authored by David Gibson's avatar David Gibson Committed by Rusty Russell

mem: Rename memmem module to mem

Currently the 'memmem' module does nothing but provide an implementation of
the memmem() function if it is missing from the standard C library.

However there are other functions (e.g. memrchr()) also missing from some
C library implementations, so rename the module to mem to allow future
inclusion of other functions.

This also updates the rfc822 module - the only existing user of the
memmem module - to use the new name.
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent fe6805a9
...@@ -72,7 +72,7 @@ MODS_WITH_SRC := antithread \ ...@@ -72,7 +72,7 @@ MODS_WITH_SRC := antithread \
lqueue \ lqueue \
lstack \ lstack \
md4 \ md4 \
memmem \ mem \
net \ net \
nfs \ nfs \
noerr \ noerr \
......
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
#include <string.h> #include <string.h>
/** /**
* memmem - Trivial module providing a memmem() implementation * mem - Provide mem*() functions if missing from C library
* *
* This code implements memmem() if it's not alreayd available in the * This code implements some string.h mem*() functions if they're not
* C library. * already available in the C library. Functions included are:
* memmem()
* *
* License: CC0 * License: CC0
*/ */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "config.h" #include "config.h"
#include <string.h> #include <string.h>
#include <ccan/memmem/memmem.h> #include <ccan/mem/mem.h>
#if !HAVE_MEMMEM #if !HAVE_MEMMEM
void *memmem(const void *haystack, size_t haystacklen, void *memmem(const void *haystack, size_t haystacklen,
......
/* CC0 (Public domain) - see LICENSE file for details */ /* CC0 (Public domain) - see LICENSE file for details */
#ifndef CCAN_MEMMEM_H #ifndef CCAN_MEM_H
#define CCAN_MEMMEM_H #define CCAN_MEM_H
#include "config.h" #include "config.h"
...@@ -11,4 +11,4 @@ void *memmem(const void *haystack, size_t haystacklen, ...@@ -11,4 +11,4 @@ void *memmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen); const void *needle, size_t needlelen);
#endif #endif
#endif /* CCAN_MEMMEM_H */ #endif /* CCAN_MEM_H */
#include <ccan/array_size/array_size.h> #include <ccan/array_size/array_size.h>
#include <ccan/memmem/memmem.h> #include <ccan/mem/mem.h>
#include <ccan/tap/tap.h> #include <ccan/tap/tap.h>
int main(void) int main(void)
......
...@@ -65,7 +65,7 @@ int main(int argc, char *argv[]) ...@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
printf("ccan/list\n"); printf("ccan/list\n");
printf("ccan/str\n"); printf("ccan/str\n");
printf("ccan/bytestring\n"); printf("ccan/bytestring\n");
printf("ccan/memmem\n"); printf("ccan/mem\n");
return 0; return 0;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <ccan/list/list.h> #include <ccan/list/list.h>
#include <stdio.h> #include <stdio.h>
#include <ccan/memmem/memmem.h> #include <ccan/mem/mem.h>
#include <ccan/rfc822/rfc822.h> #include <ccan/rfc822/rfc822.h>
#ifdef TAL_USE_TALLOC #ifdef TAL_USE_TALLOC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment