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

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

diff --git a/ccan/memmem/LICENSE b/ccan/memfuncs/LICENSE
similarity index 100%
rename from ccan/memmem/LICENSE
rename to ccan/memfuncs/LICENSE
diff --git a/ccan/memmem/_info b/ccan/memfuncs/_info
similarity index 62%
rename from ccan/memmem/_info
rename to ccan/memfuncs/_info
index 3361be9..97121bf 100644
--- a/ccan/memmem/_info
+++ b/ccan/memfuncs/_info
@@ -3,10 +3,11 @@
 #include <string.h>
 
 /**
- * memmem - Trivial module providing a memmem() implementation
+ * memfuncs - 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/memfuncs/memfuncs.c
similarity index 93%
rename from ccan/memmem/memmem.c
rename to ccan/memfuncs/memfuncs.c
index 48a6de2..c80b862 100644
--- a/ccan/memmem/memmem.c
+++ b/ccan/memfuncs/memfuncs.c
@@ -3,7 +3,7 @@
 #include "config.h"
 
 #include <string.h>
-#include <ccan/memmem/memmem.h>
+#include <ccan/memfuncs/memfuncs.h>
 
 #if !HAVE_MEMMEM
 void *memmem(const void *haystack, size_t haystacklen,
diff --git a/ccan/memmem/memmem.h b/ccan/memfuncs/memfuncs.h
similarity index 74%
rename from ccan/memmem/memmem.h
rename to ccan/memfuncs/memfuncs.h
index 4da5394..bbc19c9 100644
--- a/ccan/memmem/memmem.h
+++ b/ccan/memfuncs/memfuncs.h
@@ -1,6 +1,6 @@
 /* CC0 (Public domain) - see LICENSE file for details */
-#ifndef CCAN_MEMMEM_H
-#define CCAN_MEMMEM_H
+#ifndef CCAN_MEMFUNCS_H
+#define CCAN_MEMFUNCS_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_MEMFUNCS_H */
diff --git a/ccan/memmem/test/run.c b/ccan/memfuncs/test/run.c
similarity index 93%
rename from ccan/memmem/test/run.c
rename to ccan/memfuncs/test/run.c
index af9aac5..45b03eb 100644
--- a/ccan/memmem/test/run.c
+++ b/ccan/memfuncs/test/run.c
@@ -1,5 +1,5 @@
 #include <ccan/array_size/array_size.h>
-#include <ccan/memmem/memmem.h>
+#include <ccan/memfuncs/memfuncs.h>
 #include <ccan/tap/tap.h>
 
 int main(void)
diff --git a/ccan/rfc822/_info b/ccan/rfc822/_info
index 7c3ca08..abbad56 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/memfuncs\n");
 		return 0;
 	}
 
diff --git a/ccan/rfc822/rfc822.c b/ccan/rfc822/rfc822.c
index 636d29a..201c8a9 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/memfuncs/memfuncs.h>
 #include <ccan/rfc822/rfc822.h>
 
 #ifdef TAL_USE_TALLOC
-- 
1.9.3



More information about the ccan mailing list