commit - d572f5860a456fe9ab48d8444dd4cbec28fcae6c
commit + f2b16adaedf4891924ea61e7f357b02c6cf42bdf
blob - 5356c711e7abf7966e72e3a0a0103d74754fdaf0
blob + f0d43195828bbf72ba276c5aa0ca530acc664943
--- got/got.c
+++ got/got.c
if (branch_name) {
struct got_object_id *head_commit_id;
TAILQ_FOREACH(pe, &paths, entry) {
- if (strlen(pe->path) == 0)
+ if (pe->path_len == 0)
continue;
error = got_error_msg(GOT_ERR_BAD_PATH,
"switching between branches requires that "
blob - 929be76fb48b7a1098cb03f674b1c4ff5f5e08a5
blob + 756faf8e9b273a128bad4efb6aedef83e1d5426c
--- include/got_path.h
+++ include/got_path.h
struct got_pathlist_entry {
TAILQ_ENTRY(got_pathlist_entry) entry;
const char *path;
+ size_t path_len;
void *data; /* data pointer provided to got_pathlist_insert() */
};
TAILQ_HEAD(got_pathlist_head, got_pathlist_entry);
blob - 3605ef1847b2bd3c005f0b2f16f925acf2d76f4d
blob + ad3315247c0c2b5991c2ed65848a2255a310541e
--- lib/path.c
+++ lib/path.c
if (new == NULL)
return got_error_from_errno("malloc");
new->path = path;
+ new->path_len = strlen(path);
new->data = data;
/*
*/
pe = TAILQ_LAST(pathlist, got_pathlist_head);
while (pe) {
- int cmp = got_path_cmp(pe->path, path,
- strlen(pe->path), strlen(path));
+ int cmp = got_path_cmp(pe->path, new->path,
+ pe->path_len, new->path_len);
if (cmp == 0) {
free(new); /* duplicate */
return NULL;
if (new == NULL)
return got_error_from_errno("malloc");
new->path = path;
+ new->path_len = strlen(path);
new->data = data;
TAILQ_INSERT_TAIL(pathlist, new, entry);
return NULL;
blob - b23c7b50712196bd076f5de77b17498bae85707b
blob + fe6944aad53fa888590f9943509e0d7a8e3dd644
--- lib/worktree.c
+++ lib/worktree.c
bbc_arg.base_commit_id = worktree->base_commit_id;
bbc_arg.entry_name = tpd->entry_name;
bbc_arg.path = pe->path;
- bbc_arg.path_len = strlen(pe->path);
+ bbc_arg.path_len = pe->path_len;
bbc_arg.progress_cb = progress_cb;
bbc_arg.progress_arg = progress_arg;
err = got_fileindex_for_each_entry_safe(fileindex,