Move manipulation functions to cn-manip.c
diff --git a/Makefile b/Makefile
index c942396..1752a6d 100644
--- a/Makefile
+++ b/Makefile
@@ -8,8 +8,8 @@
 	env MallocStackLogging=true ./cntest >new.out
 	-diff new.out expected.out
 
-cntest: test.c cbor.h cn-cbor.h cn-cbor.c
-	clang $(CFLAGS) cn-cbor.c cn-error.c test.c -o cntest
+cntest: test.c cbor.h cn-cbor.h cn-cbor.c cn-manip.c
+	clang $(CFLAGS) cn-cbor.c cn-error.c cn-manip.c test.c -o cntest
 
 size: cn-cbor.o
 	size cn-cbor.o
diff --git a/cn-cbor.c b/cn-cbor.c
index 222be64..e0fd53b 100644
--- a/cn-cbor.c
+++ b/cn-cbor.c
@@ -245,70 +245,6 @@
   return ret;
 }
 
-const cn_cbor* cn_cbor_mapget_int(const cn_cbor* cb, int key) {
-  cn_cbor* cp;
-  assert(cb);
-  for (cp = cb->first_child; cp && cp->next; cp = cp->next->next) {
-    switch(cp->type) {
-    case CN_CBOR_UINT:
-      if (cp->v.uint == (unsigned long)key) {
-        return cp->next;
-      }
-    case CN_CBOR_INT:
-      if (cp->v.sint == (long)key) {
-        return cp->next;
-      }
-      break;
-    default:
-      ; // skip non-integer keys
-    }
-  }
-  return NULL;
-}
-
-const cn_cbor* cn_cbor_mapget_string(const cn_cbor* cb, const char* key) {
-  cn_cbor *cp;
-  int keylen;
-  assert(cb);
-  assert(key);
-  keylen = strlen(key);
-  for (cp = cb->first_child; cp && cp->next; cp = cp->next->next) {
-    switch(cp->type) {
-    case CN_CBOR_TEXT:
-      if (keylen != cp->length) {
-        continue;
-      }
-      if (strncmp(key, cp->v.str, cp->length) == 0) {
-        return cp->next;
-      }
-      break;
-    case CN_CBOR_BYTES:
-      if (keylen != cp->length) {
-        continue;
-      }
-      if (memcmp(key, cp->v.str, keylen) == 0) {
-        return cp->next;
-      }
-    default:
-      ; // skip non-string keys
-    }
-  }
-  return NULL;
-}
-
-const cn_cbor* cn_cbor_index(const cn_cbor* cb, int idx) {
-  cn_cbor *cp;
-  int i = 0;
-  assert(cb);
-  for (cp = cb->first_child; cp; cp = cp->next) {
-    if (i == idx) {
-      return cp;
-    }
-    i++;
-  }
-  return NULL;
-}
-
 #ifdef  __cplusplus
 }
 #endif
diff --git a/cn-manip.c b/cn-manip.c
new file mode 100644
index 0000000..4f91c45
--- /dev/null
+++ b/cn-manip.c
@@ -0,0 +1,69 @@
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#include "cn-cbor.h"
+
+const cn_cbor* cn_cbor_mapget_int(const cn_cbor* cb, int key) {
+  cn_cbor* cp;
+  assert(cb);
+  for (cp = cb->first_child; cp && cp->next; cp = cp->next->next) {
+    switch(cp->type) {
+    case CN_CBOR_UINT:
+      if (cp->v.uint == (unsigned long)key) {
+        return cp->next;
+      }
+    case CN_CBOR_INT:
+      if (cp->v.sint == (long)key) {
+        return cp->next;
+      }
+      break;
+    default:
+      ; // skip non-integer keys
+    }
+  }
+  return NULL;
+}
+
+const cn_cbor* cn_cbor_mapget_string(const cn_cbor* cb, const char* key) {
+  cn_cbor *cp;
+  int keylen;
+  assert(cb);
+  assert(key);
+  keylen = strlen(key);
+  for (cp = cb->first_child; cp && cp->next; cp = cp->next->next) {
+    switch(cp->type) {
+    case CN_CBOR_TEXT:
+      if (keylen != cp->length) {
+        continue;
+      }
+      if (strncmp(key, cp->v.str, cp->length) == 0) {
+        return cp->next;
+      }
+      break;
+    case CN_CBOR_BYTES:
+      if (keylen != cp->length) {
+        continue;
+      }
+      if (memcmp(key, cp->v.str, keylen) == 0) {
+        return cp->next;
+      }
+    default:
+      ; // skip non-string keys
+    }
+  }
+  return NULL;
+}
+
+const cn_cbor* cn_cbor_index(const cn_cbor* cb, int idx) {
+  cn_cbor *cp;
+  int i = 0;
+  assert(cb);
+  for (cp = cb->first_child; cp; cp = cp->next) {
+    if (i == idx) {
+      return cp;
+    }
+    i++;
+  }
+  return NULL;
+}