[ccan] [PATCH 1/3] mem: Rename memmem module to mem

David Gibson david at gibson.dropbear.id.au
Wed Oct 22 22:56:51 AEDT 2014


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: David Gibson <david at gibson.dropbear.id.au>
---
 ccan/{memmem => mem}/LICENSE        | 0
 ccan/{memmem => mem}/_info          | 7 ++++---
 ccan/{memmem/memmem.c => mem/mem.c} | 2 +-
 ccan/{memmem/memmem.h => mem/mem.h} | 6 +++---
 ccan/{memmem => mem}/test/run.c     | 2 +-
 ccan/rfc822/_info                   | 2 +-
 ccan/rfc822/rfc822.c                | 2 +-
 7 files changed, 11 insertions(+), 10 deletions(-)
 rename ccan/{memmem => mem}/LICENSE (100%)
 rename ccan/{memmem => mem}/_info (62%)
 rename ccan/{memmem/memmem.c => mem/mem.c} (93%)
 rename ccan/{memmem/memmem.h => mem/mem.h} (76%)
 rename ccan/{memmem => mem}/test/run.c (94%)

diff --git a/ccan/memmem/LICENSE b/ccan/mem/LICENSE
similarity index 100%
rename from ccan/memmem/LICENSE
rename to ccan/mem/LICENSE
diff --git a/ccan/memmem/_info b/ccan/mem/_info
similarity index 62%
rename from ccan/memmem/_info
rename to ccan/mem/_info
index 3361be9..19b2228 100644
--- a/ccan/memmem/_info
+++ b/ccan/mem/_info
@@ -3,10 +3,11 @@
 #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
- * C library.
+ * This code implements some string.h mem*() functions if they're not
+ * already available in the C library.  Functions included are:
+ *	memmem()
  *
  * License: CC0
  */
diff --git a/ccan/memmem/memmem.c b/ccan/mem/mem.c
similarity index 93%
rename from ccan/memmem/memmem.c
rename to ccan/mem/mem.c
index 48a6de2..ce675ff 100644
--- a/ccan/memmem/memmem.c
+++ b/ccan/mem/mem.c
@@ -3,7 +3,7 @@
 #include "config.h"
 
 #include <string.h>
-#include <ccan/memmem/memmem.h>
+#include <ccan/mem/mem.h>
 
 #if !HAVE_MEMMEM
 void *memmem(const void *haystack, size_t haystacklen,
diff --git a/ccan/memmem/memmem.h b/ccan/mem/mem.h
similarity index 76%
rename from ccan/memmem/memmem.h
rename to ccan/mem/mem.h
index 4da5394..771d052 100644
--- a/ccan/memmem/memmem.h
+++ b/ccan/mem/mem.h
@@ -1,6 +1,6 @@
 /* CC0 (Public domain) - see LICENSE file for details */
-#ifndef CCAN_MEMMEM_H
-#define CCAN_MEMMEM_H
+#ifndef CCAN_MEM_H
+#define CCAN_MEM_H
 
 #include "config.h"
 
@@ -11,4 +11,4 @@ void *memmem(const void *haystack, size_t haystacklen,
 	     const void *needle, size_t needlelen);
 #endif
 
-#endif /* CCAN_MEMMEM_H */
+#endif /* CCAN_MEM_H */
diff --git a/ccan/memmem/test/run.c b/ccan/mem/test/run.c
similarity index 94%
rename from ccan/memmem/test/run.c
rename to ccan/mem/test/run.c
index af9aac5..3efd1d8 100644
--- a/ccan/memmem/test/run.c
+++ b/ccan/mem/test/run.c
@@ -1,5 +1,5 @@
 #include <ccan/array_size/array_size.h>
-#include <ccan/memmem/memmem.h>
+#include <ccan/mem/mem.h>
 #include <ccan/tap/tap.h>
 
 int main(void)
diff --git a/ccan/rfc822/_info b/ccan/rfc822/_info
index 7c3ca08..680f499 100644
--- a/ccan/rfc822/_info
+++ b/ccan/rfc822/_info
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
 		printf("ccan/list\n");
 		printf("ccan/str\n");
 		printf("ccan/bytestring\n");
-		printf("ccan/memmem\n");
+		printf("ccan/mem\n");
 		return 0;
 	}
 
diff --git a/ccan/rfc822/rfc822.c b/ccan/rfc822/rfc822.c
index 636d29a..2d23b9c 100644
--- a/ccan/rfc822/rfc822.c
+++ b/ccan/rfc822/rfc822.c
@@ -8,7 +8,7 @@
 #include <ccan/list/list.h>
 #include <stdio.h>
 
-#include <ccan/memmem/memmem.h>
+#include <ccan/mem/mem.h>
 #include <ccan/rfc822/rfc822.h>
 
 #ifdef TAL_USE_TALLOC
-- 
1.9.3



More information about the ccan mailing list