i += j;
if (key[i] == '\0') {
- if (node->values) {
- value = strdup(node->values[0].value);
- index_close(node);
- return value;
- } else {
- return NULL;
- }
+ value = node->values != NULL
+ ? strdup(node->values[0].value)
+ : NULL;
+
+ index_close(node);
+ return value;
}
child = index_readchild(node, key[i]);
i += j;
if (key[i] == '\0') {
- if (node->values.len > 0) {
- value = strdup(node->values.values[0].value);
- index_mm_free_node(node);
- return value;
- } else {
- return NULL;
- }
+ value = node->values.len > 0
+ ? strdup(node->values.values[0].value)
+ : NULL;
+
+ index_mm_free_node(node);
+ return value;
}
child = index_mm_readchild(node, key[i]);