From: Jani Nikula Date: Sun, 10 Apr 2016 19:43:23 +0000 (+0300) Subject: lib: clean up _notmuch_database_split_path X-Git-Tag: 0.22_rc0~12 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=54aeab1962d77455a65d0d4338beaabbb936310f;hp=a352d9ceaa7e08b7c9de294419ec4c323b81ca15;ds=sidebyside lib: clean up _notmuch_database_split_path Make the logic it a bit easier to read. No functional changes. --- diff --git a/lib/database.cc b/lib/database.cc index b8486f7d..c8c5e261 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -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)