diff options
author | Patrick Steinhardt <ps@pks.im> | 2018-11-23 19:26:48 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2018-11-28 15:22:27 +0100 |
commit | ae765d0013e767e0c3824eea439a606b81f3083a (patch) | |
tree | 4a28a1b836ed5bf560e8438d0c9209c54012b10e | |
parent | 0278978285107a7a34592d537243b4c89ade85cf (diff) | |
download | libgit2-ae765d0013e767e0c3824eea439a606b81f3083a.tar.gz |
submodule: remove string map implementation that strips trailing slashes
The submodule code currently has its own implementation of a string map,
which overrides the hashing and hash equals functions with functions
that ignore potential trailing slashes. These functions aren't actually
used by our code, making them useless.
-rw-r--r-- | src/submodule.c | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/submodule.c b/src/submodule.c index 825e85a52..315771614 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -60,35 +60,6 @@ enum { GITMODULES_CREATE = 1, }; -static kh_inline khint_t str_hash_no_trailing_slash(const char *s) -{ - khint_t h; - - for (h = 0; *s; ++s) - if (s[1] != '\0' || *s != '/') - h = (h << 5) - h + *s; - - return h; -} - -static kh_inline int str_equal_no_trailing_slash(const char *a, const char *b) -{ - size_t alen = a ? strlen(a) : 0; - size_t blen = b ? strlen(b) : 0; - - if (alen > 0 && a[alen - 1] == '/') - alen--; - if (blen > 0 && b[blen - 1] == '/') - blen--; - - return (alen == 0 && blen == 0) || - (alen == blen && strncmp(a, b, alen) == 0); -} - -__KHASH_IMPL( - str, static kh_inline, const char *, void *, 1, - str_hash_no_trailing_slash, str_equal_no_trailing_slash) - static int submodule_alloc(git_submodule **out, git_repository *repo, const char *name); static git_config_backend *open_gitmodules(git_repository *repo, int gitmod); static int gitmodules_snapshot(git_config **snap, git_repository *repo); |