| | 46 | | | | | | CONFIG_NODE *config_node_section_index(CONFIG_NODE *parent, const char *key, | | | 47 | | | | | | int index, int new_type) | | | 48 | | | | | | { | | | 49 | | | | | | CONFIG_NODE *node; | | | 50 | | | | | | int nindex; | | | 51 | | | | | | | | true | 52 | | | | | | g_return_val_if_fail(parent != NULL, NULL);
| | | 53 | | | | | | g_return_val_if_fail(is_node_list(parent), NULL);
| | | 54 | | | | | | | | | 55 | | | | | | node = key == NULL ? NULL : config_node_find(parent, key);
| | | 56 | | | | | | if (node != NULL) {
| | | 57 | | | | | | g_return_val_if_fail(new_type == -1 || new_type == node->type, NULL);
| | | 58 | | | | | | nindex = g_slist_index(parent->value, node); | | | 59 | | | | | | if (index >= 0 && nindex != index && | | | 60 | | | | | | nindex <= g_slist_length(parent->value)) { | | | 61 | | | | | | | | | 62 | | | | | | parent->value = g_slist_remove(parent->value, node); | | | | | | | | | ... | | | 69 | | | | | | return NULL;
| | | 70 | | | | | | | | | 71 | | | | | | node = g_new0(CONFIG_NODE, 1);
| | | 72 | | | | | | parent->value = index < 0 ? g_slist_append(parent->value, node) : | | | 73 | | | | | | g_slist_insert(parent->value, node, index); | | | 74 | | | | | | | | | 75 | | | | | | node->type = new_type; | | | 76 | | | | | | node->key = key == NULL ? NULL : g_strdup(key);
| | | 77 | | | | | | | | | 78 | | | | | | return node; | | config_node_section_index$return <= 4095 | 79 | | | | | | } | Problem | | config_node_section_index$return <= 4095 |
|
|