diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-25 16:50:22 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-25 16:50:22 +0100 |
commit | b8f90a3aecef97a0a37a007bc56ec85c94591773 (patch) | |
tree | 67cf8f911fb9d7b837e4c15589686b9e2f7cc139 /FICS | |
parent | 507cae65107e82a605ff2f3d4f0fc48b6d0531fc (diff) |
Reformatted t_sft()
Diffstat (limited to 'FICS')
-rw-r--r-- | FICS/utils.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/FICS/utils.c b/FICS/utils.c index 49ab0c4..89a35c3 100644 --- a/FICS/utils.c +++ b/FICS/utils.c @@ -888,20 +888,26 @@ struct t_dirs { PRIVATE char **t_buffer = NULL; /* pointer to next space in return buffer */ PRIVATE int t_buffersize = 0; /* size of return buffer */ -/* fill t_buffer with anything matching "want*" in file tree t_tree */ -PRIVATE void t_sft(char *want, struct t_tree *t) +/* + * Fill 't_buffer' with anything matching "want*" in file tree + */ +PRIVATE void +t_sft(char *want, struct t_tree *t) { - if (t) { - int cmp = strncmp(want, &t->name, strlen(want)); - if (cmp <= 0) /* if want <= this one, look left */ - t_sft(want, t->left); - if (t_buffersize && (cmp == 0)) { /* if a match, add it to buffer */ - t_buffersize--; - *t_buffer++ = &(t->name); - } - if (cmp >= 0) /* if want >= this one, look right */ - t_sft(want, t->right); - } + if (t) { + int cmp = strncmp(want, &t->name, strlen(want)); + + if (cmp <= 0) // If 'want' <= this one, look left + t_sft(want, t->left); + + if (t_buffersize && cmp == 0) { // If a match, add it to buffer + t_buffersize--; + *t_buffer++ = &(t->name); + } + + if (cmp >= 0) // If 'want' >= this one, look right + t_sft(want, t->right); + } } /* |