Remove imap, as it was ugly and nobody used it.
authorDavid Given <dg@cowlark.com>
Thu, 12 Jan 2017 22:28:35 +0000 (23:28 +0100)
committerDavid Given <dg@cowlark.com>
Thu, 12 Jan 2017 22:28:35 +0000 (23:28 +0100)
modules/src/data/imap.c [deleted file]
modules/src/data/imap.h [deleted file]

diff --git a/modules/src/data/imap.c b/modules/src/data/imap.c
deleted file mode 100644 (file)
index 81982a7..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#include <stdlib.h>
-#include <stdbool.h>
-#include "imap.h"
-
-static void append(void* mapp, int left, void* right)
-{
-    struct imap* map = mapp;
-    struct imap_node* node;
-
-       if (map->count == map->max)
-       {
-               int newmax = (map->max == 0) ? 8 : (map->max * 2);
-               struct imap_node* newarray = realloc(map->item, newmax * sizeof(*newarray));
-
-               map->max = newmax;
-               map->item = newarray;
-       }
-
-    node = &map->item[map->count];
-    map->count++;
-
-    node->left = left;
-    node->right = right;
-}
-
-void imap_put(void* mapp, int left, void* right)
-{
-    struct imap* map = mapp;
-    int i;
-
-    for (i=0; i<map->count; i++)
-    {
-        struct imap_node* node = &map->item[i];
-        if (node->left == left)
-        {
-            node->right = right;
-            return;
-        }
-    }
-
-    append(map, left, right);
-}
-
-void imap_add(void* mapp, int left, void* right)
-{
-    struct imap* map = mapp;
-    int i;
-
-    for (i=0; i<map->count; i++)
-    {
-        struct imap_node* node = &map->item[i];
-        if ((node->left == left) && (node->right == right))
-            return;
-    }
-
-    append(map, left, right);
-}
-
-void* imap_get(void* mapp, int left)
-{
-    struct imap* map = mapp;
-    int i;
-
-    for (i=0; i<map->count; i++)
-    {
-        struct imap_node* node = &map->item[i];
-               if (node->left == left)
-                       return node->right;
-    }
-
-       return NULL;
-}
-
-
diff --git a/modules/src/data/imap.h b/modules/src/data/imap.h
deleted file mode 100644 (file)
index cb312e1..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef IMAP_H
-#define IMAP_H
-
-struct imap_node
-{
-       int left;
-       void* right;
-};
-
-/* Danger, Will Robinson! The type and the macro must be compatible. */
-
-struct imap
-{
-       struct imap_node* item;
-       int count;
-       int max;
-};
-
-#define IMAPOF(RIGHT) \
-       struct { \
-               struct { int left; RIGHT* right; }* item; \
-               int count; \
-               int max; \
-       }
-
-extern void imap_put(void* map, int left, void* right);
-extern void imap_add(void* map, int left, void* right);
-extern void* imap_get(void* map, int left);
-
-#endif
-