Skip to content

Commit ae765d0

Browse files
committed
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.
1 parent 0278978 commit ae765d0

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

src/submodule.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -60,35 +60,6 @@ enum {
6060
GITMODULES_CREATE = 1,
6161
};
6262

63-
static kh_inline khint_t str_hash_no_trailing_slash(const char *s)
64-
{
65-
khint_t h;
66-
67-
for (h = 0; *s; ++s)
68-
if (s[1] != '\0' || *s != '/')
69-
h = (h << 5) - h + *s;
70-
71-
return h;
72-
}
73-
74-
static kh_inline int str_equal_no_trailing_slash(const char *a, const char *b)
75-
{
76-
size_t alen = a ? strlen(a) : 0;
77-
size_t blen = b ? strlen(b) : 0;
78-
79-
if (alen > 0 && a[alen - 1] == '/')
80-
alen--;
81-
if (blen > 0 && b[blen - 1] == '/')
82-
blen--;
83-
84-
return (alen == 0 && blen == 0) ||
85-
(alen == blen && strncmp(a, b, alen) == 0);
86-
}
87-
88-
__KHASH_IMPL(
89-
str, static kh_inline, const char *, void *, 1,
90-
str_hash_no_trailing_slash, str_equal_no_trailing_slash)
91-
9263
static int submodule_alloc(git_submodule **out, git_repository *repo, const char *name);
9364
static git_config_backend *open_gitmodules(git_repository *repo, int gitmod);
9465
static int gitmodules_snapshot(git_config **snap, git_repository *repo);

0 commit comments

Comments
 (0)