From 9593fc545950782ed75f12f53238b07885559b2b Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 9 Jul 2018 22:28:25 -0700 Subject: remove ccan for now --- ccan/htable/_info | 117 ------------------------------------------------------ 1 file changed, 117 deletions(-) delete mode 100644 ccan/htable/_info (limited to 'ccan/htable/_info') diff --git a/ccan/htable/_info b/ccan/htable/_info deleted file mode 100644 index a3bb76d..0000000 --- a/ccan/htable/_info +++ /dev/null @@ -1,117 +0,0 @@ -#include "config.h" -#include -#include - -/** - * htable - hash table routines - * - * A hash table is an efficient structure for looking up keys. This version - * grows with usage and allows efficient deletion. - * - * Example: - * #include - * #include - * #include - * #include - * #include - * - * struct name_to_digit { - * const char *name; - * unsigned int val; - * }; - * - * static struct name_to_digit map[] = { - * { "zero", 0}, - * { "one", 1 }, - * { "two", 2 }, - * { "three", 3 }, - * { "four", 4 }, - * { "five", 5 }, - * { "six", 6 }, - * { "seven", 7 }, - * { "eight", 8 }, - * { "nine", 9 } - * }; - * - * // Wrapper for rehash function pointer. - * static size_t rehash(const void *e, void *unused) - * { - * (void)unused; - * return hash_string(((struct name_to_digit *)e)->name); - * } - * - * // Comparison function. - * static bool streq(const void *e, void *string) - * { - * return strcmp(((struct name_to_digit *)e)->name, string) == 0; - * } - * - * // We let them add their own aliases, eg. --alias=v=5 - * static void add_alias(struct htable *ht, const char *alias) - * { - * char *eq; - * struct name_to_digit *n; - * - * n = malloc(sizeof(*n)); - * n->name = strdup(alias); - * - * eq = strchr(n->name, '='); - * if (!eq || ((n->val = atoi(eq+1)) == 0 && !strcmp(eq+1, "0"))) - * errx(1, "Usage: --alias=="); - * *eq = '\0'; - * htable_add(ht, hash_string(n->name), n); - * } - * - * int main(int argc, char *argv[]) - * { - * struct htable ht; - * int i; - * unsigned long val; - * - * if (argc < 2) - * errx(1, "Usage: %s [--alias==]... ...", - * argv[0]); - * - * // Create and populate hash table. - * htable_init(&ht, rehash, NULL); - * for (i = 0; i < (int)(sizeof(map)/sizeof(map[0])); i++) - * htable_add(&ht, hash_string(map[i].name), &map[i]); - * - * // Add any aliases to the hash table. - * for (i = 1; i < argc; i++) { - * if (!strncmp(argv[i], "--alias=", strlen("--alias="))) - * add_alias(&ht, argv[i] + strlen("--alias=")); - * else - * break; - * } - * - * // Find the other args in the hash table. - * for (val = 0; i < argc; i++) { - * struct name_to_digit *n; - * n = htable_get(&ht, hash_string(argv[i]), - * streq, argv[i]); - * if (!n) - * errx(1, "Invalid digit name %s", argv[i]); - * // Append it to the value we are building up. - * val *= 10; - * val += n->val; - * } - * printf("%lu\n", val); - * return 0; - * } - * - * License: LGPL (v2.1 or any later version) - * Author: Rusty Russell - */ -int main(int argc, char *argv[]) -{ - if (argc != 2) - return 1; - - if (strcmp(argv[1], "depends") == 0) { - printf("ccan/compiler\n"); - return 0; - } - - return 1; -} -- cgit v1.2.3