Treeview: Improve some code wrapping.

This commit is contained in:
Michael Drake 2017-09-10 11:57:02 +01:00
parent 37127c4a52
commit 50688cde51

View File

@ -962,7 +962,7 @@ treeview_create_node_entry(treeview *tree,
} }
e = malloc(sizeof(struct treeview_node_entry) + e = malloc(sizeof(struct treeview_node_entry) +
(tree->n_fields - 1) * sizeof(struct treeview_field)); (tree->n_fields - 1) * sizeof(struct treeview_field));
if (e == NULL) { if (e == NULL) {
return NSERROR_NOMEM; return NSERROR_NOMEM;
} }
@ -978,8 +978,8 @@ treeview_create_node_entry(treeview *tree,
assert(fields != NULL); assert(fields != NULL);
assert(fields[0].field != NULL); assert(fields[0].field != NULL);
assert(lwc_string_isequal(tree->fields[0].field, assert(lwc_string_isequal(tree->fields[0].field,
fields[0].field, &match) == lwc_error_ok && fields[0].field, &match) == lwc_error_ok &&
match == true); match == true);
n->text.data = fields[0].value; n->text.data = fields[0].value;
n->text.len = fields[0].value_len; n->text.len = fields[0].value_len;
n->text.width = 0; n->text.width = 0;
@ -994,8 +994,8 @@ treeview_create_node_entry(treeview *tree,
for (i = 1; i < tree->n_fields; i++) { for (i = 1; i < tree->n_fields; i++) {
assert(fields[i].field != NULL); assert(fields[i].field != NULL);
assert(lwc_string_isequal(tree->fields[i].field, assert(lwc_string_isequal(tree->fields[i].field,
fields[i].field, &match) == lwc_error_ok && fields[i].field, &match) == lwc_error_ok &&
match == true); match == true);
e->fields[i - 1].value.data = fields[i].value; e->fields[i - 1].value.data = fields[i].value;
e->fields[i - 1].value.len = fields[i].value_len; e->fields[i - 1].value.len = fields[i].value_len;
@ -1103,11 +1103,10 @@ treeview_walk(treeview *tree,
if (root == NULL) if (root == NULL)
root = tree->root; root = tree->root;
return treeview_walk_internal(root, return treeview_walk_internal(root, true,
true, (leave_cb != NULL) ? treeview_walk_bwd_cb : NULL,
(leave_cb != NULL) ? treeview_walk_bwd_cb : NULL, (enter_cb != NULL) ? treeview_walk_fwd_cb : NULL,
(enter_cb != NULL) ? treeview_walk_fwd_cb : NULL, &tw);
&tw);
} }