GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — map/test_map.c at master · Broadroad/map Expand file tree/ Copy pathtest_map.cMore file actions 59 lines (47 loc) · 1.26 KB / Copy pathtest_map.cFile metadata and controls59 lines (47 loc) · 1.26 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 /*************************************************************************** * * Copyright (c) 2016 zkdnfcf, Inc. All Rights Reserved * $Id$ * **************************************************************************/ /** * @file test_map.c * @author zk([email protected]) * @date 2016/06/01 09:38:32 * @version $Revision$ * @brief * **/ #include "rbtree.h" #include "map.h" #include <stdio.h> #include <unistd.h> root_t tree = RB_ROOT; int main() { char *key = "hello"; char *word = "world"; put(&tree, key, word); char *key1 = "hello 1"; char *word1 = "world 1"; put(&tree, key1, word1); char *key2 = "hello 1"; char *word2 = "world 2 change"; put(&tree, key2, word2); map_t *data1 = get(&tree, "hello 1"); if (data1 != NULL) printf("%s\n", data1->val); map_t *node; for (node = map_first(&tree); node; node=map_next(&(node->node))) { printf("%s\n", node->key); } // free map if you don't need map_t *nodeFree = NULL; for (nodeFree = map_first(&tree); nodeFree; nodeFree = map_first(&tree)) { if (nodeFree) { rb_erase(&nodeFree->node, &tree); map_free(nodeFree); } } return 0; } /* vim: set ts=4 sw=4 sts=4 tw=100 */ |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |