diff options
| author | Yuri Volchkov <yuri.volchkov@gmail.com> | 2017-08-21 17:44:45 +0200 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2017-08-22 18:47:51 -0300 |
| commit | cec4a87539599e7d253b694c2a0a81de86d6eb7e (patch) | |
| tree | b9b764a68074a6f06d1d3d43dd3f3cfdb3da2fb3 /util/string-util.h | |
| parent | 49d4f52f270773f86c90eb1c50805d1d7429d39b (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 'util/string-util.h')
| -rw-r--r-- | util/string-util.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/util/string-util.h b/util/string-util.h index 87917b8f..97770614 100644 --- a/util/string-util.h +++ b/util/string-util.h @@ -75,6 +75,8 @@ int strcase_equal (const void *a, const void *b); /* GLib GHashFunc compatible case insensitive hash function */ unsigned int strcase_hash (const void *ptr); +void strip_trailing (char *str, char ch); + #ifdef __cplusplus } #endif |
