aboutsummaryrefslogtreecommitdiff
path: root/lib/database.cc
diff options
context:
space:
mode:
authorYuri Volchkov <yuri.volchkov@gmail.com>2017-08-21 17:44:45 +0200
committerDavid Bremner <david@tethera.net>2017-08-22 18:47:51 -0300
commitcec4a87539599e7d253b694c2a0a81de86d6eb7e (patch)
treeb9b764a68074a6f06d1d3d43dd3f3cfdb3da2fb3 /lib/database.cc
parent49d4f52f270773f86c90eb1c50805d1d7429d39b (diff)
database: move striping of trailing '/' into helper function
Stripping trailing character is not that uncommon operation. Particularly, the next patch has to perform it as well. Lets move it to the separate function to avoid code duplication. Also the new function has a little improvement: if the character to strip is repeated several times in the end of a string, function strips them all. Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
Diffstat (limited to 'lib/database.cc')
-rw-r--r--lib/database.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/database.cc b/lib/database.cc
index 8f0e22a8..79eb3d69 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -858,8 +858,7 @@ notmuch_database_open_verbose (const char *path,
notmuch->status_string = NULL;
notmuch->path = talloc_strdup (notmuch, path);
- if (notmuch->path[strlen (notmuch->path) - 1] == '/')
- notmuch->path[strlen (notmuch->path) - 1] = '\0';
+ strip_trailing(notmuch->path, '/');
notmuch->mode = mode;
notmuch->atomic_nesting = 0;