| | 81 | | | | CONFIG_NODE *config_node_traverse(CONFIG_REC *rec, const char *section, int create) | | | 82 | | | | { | | | 83 | | | | CONFIG_NODE *node; | | | 84 | | | | char **list, **tmp, *str; | | | 85 | | | | int is_list, new_type; | | | 86 | | | | | | | 87 | | | | g_return_val_if_fail(rec != NULL, NULL);
| | | 88 | | | | | | | 89 | | | | if (section == NULL || *section == '\0')
| | | 90 | | | | return rec->mainnode; | | | 91 | | | | | | | 92 | | | | | | | 93 | | | | node = g_hash_table_lookup(rec->cache, section); | | | 94 | | | | if (node != NULL) return node;
| | | 95 | | | | | | | 96 | | | | new_type = -1; | | | 97 | | | | | | | 98 | | | | node = rec->mainnode; | | | 99 | | | | list = g_strsplit(section, "/", -1); | | | 100 | | | | for (tmp = list; *tmp != NULL; tmp++) {
| | | 101 | | | | is_list = **tmp == '('; | | | 102 | | | | if (create) new_type = is_list ? NODE_TYPE_LIST : NODE_TYPE_BLOCK; | | | 103 | | | | | | | 104 | | | | node = config_node_section(node, *tmp + is_list, new_type); | | | 105 | | | | if (node == NULL) {
| | | 106 | | | | g_strfreev(list); | | | 107 | | | | return NULL;
| | | 108 | | | | } | | | 109 | | | | } | | | 110 | | | | g_strfreev(list); | | | 111 | | | | | | | 112 | | | | | | | 113 | | | | str = g_strdup(section); | | | 114 | | | | g_hash_table_insert(rec->cache, str, node); | | | 115 | | | | g_hash_table_insert(rec->cache_nodes, node, str); | | | 116 | | | | return node; | | mainconfig->mainnode <= 4095 | 117 | | | | } | Problem | | mainconfig->mainnode <= 4095 |
|
|