mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
lib: clean up _notmuch_database_split_path
Make the logic it a bit easier to read. No functional changes.
This commit is contained in:
parent
a352d9ceaa
commit
54aeab1962
1 changed files with 3 additions and 14 deletions
|
@ -1761,18 +1761,11 @@ _notmuch_database_split_path (void *ctx,
|
|||
slash = path + strlen (path) - 1;
|
||||
|
||||
/* First, skip trailing slashes. */
|
||||
while (slash != path) {
|
||||
if (*slash != '/')
|
||||
break;
|
||||
|
||||
while (slash != path && *slash == '/')
|
||||
--slash;
|
||||
}
|
||||
|
||||
/* Then, find a slash. */
|
||||
while (slash != path) {
|
||||
if (*slash == '/')
|
||||
break;
|
||||
|
||||
while (slash != path && *slash != '/') {
|
||||
if (basename)
|
||||
*basename = slash;
|
||||
|
||||
|
@ -1780,12 +1773,8 @@ _notmuch_database_split_path (void *ctx,
|
|||
}
|
||||
|
||||
/* Finally, skip multiple slashes. */
|
||||
while (slash != path) {
|
||||
if (*(slash - 1) != '/')
|
||||
break;
|
||||
|
||||
while (slash != path && *(slash - 1) == '/')
|
||||
--slash;
|
||||
}
|
||||
|
||||
if (slash == path) {
|
||||
if (directory)
|
||||
|
|
Loading…
Reference in a new issue