mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
cli: simplify mime node walk
The function is more straighforward to read when it's clear that the only non-NULL return is at one place. No functional changes.
This commit is contained in:
parent
8481372956
commit
069362ee10
1 changed files with 7 additions and 6 deletions
13
mime-node.c
13
mime-node.c
|
@ -322,20 +322,21 @@ mime_node_child (mime_node_t *parent, int child)
|
||||||
static mime_node_t *
|
static mime_node_t *
|
||||||
_mime_node_seek_dfs_walk (mime_node_t *node, int *n)
|
_mime_node_seek_dfs_walk (mime_node_t *node, int *n)
|
||||||
{
|
{
|
||||||
mime_node_t *ret = NULL;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (*n == 0)
|
if (*n == 0)
|
||||||
return node;
|
return node;
|
||||||
|
|
||||||
*n -= 1;
|
*n -= 1;
|
||||||
for (i = 0; i < node->nchildren && !ret; i++) {
|
for (i = 0; i < node->nchildren; i++) {
|
||||||
mime_node_t *child = mime_node_child (node, i);
|
mime_node_t *child = mime_node_child (node, i);
|
||||||
ret = _mime_node_seek_dfs_walk (child, n);
|
mime_node_t *ret = _mime_node_seek_dfs_walk (child, n);
|
||||||
if (!ret)
|
if (ret)
|
||||||
talloc_free (child);
|
return ret;
|
||||||
|
|
||||||
|
talloc_free (child);
|
||||||
}
|
}
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mime_node_t *
|
mime_node_t *
|
||||||
|
|
Loading…
Reference in a new issue