database: move striping of trailing '/' into helper function
authorYuri Volchkov <yuri.volchkov@gmail.com>
Mon, 21 Aug 2017 15:44:45 +0000 (17:44 +0200)
committerDavid Bremner <david@tethera.net>
Tue, 22 Aug 2017 21:47:51 +0000 (18:47 -0300)
commitcec4a87539599e7d253b694c2a0a81de86d6eb7e
treeb9b764a68074a6f06d1d3d43dd3f3cfdb3da2fb3
parent49d4f52f270773f86c90eb1c50805d1d7429d39b
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>
lib/database.cc
util/string-util.c
util/string-util.h