Commit Diff


commit - 5345b4c7e102ec42f81e1b9b229294a0774d9b40
commit + aea75d87862c3ab54d0b8c5e5e280e13efe8ec4a
blob - 8bec2bca2e235fe87cbfca896a76cb8a1e46e6dc
blob + 08e7b0ccff9dcc74255388ca93d624636feee5ab
--- lib/got_lib_pack.h
+++ lib/got_lib_pack.h
@@ -173,7 +173,7 @@ const struct got_error *got_packidx_init_hdr(struct go
 const struct got_error *got_packidx_open(struct got_packidx **,
     int, const char *, int);
 const struct got_error *got_packidx_close(struct got_packidx *);
-const struct got_error *got_packidx_get_packfile_path(char **, struct got_packidx *);
+const struct got_error *got_packidx_get_packfile_path(char **, const char *);
 off_t got_packidx_get_object_offset(struct got_packidx *, int idx);
 int got_packidx_get_object_idx(struct got_packidx *, struct got_object_id *);
 const struct got_error *got_packidx_match_id_str_prefix(
blob - 5c5f3bb280d592509f3a929c1b15d6003d2faa97
blob + bd60cd8b6abcd2895c9cbddca8e0c99886f92531
--- lib/object.c
+++ lib/object.c
@@ -346,7 +346,8 @@ got_object_open_packed(struct got_object **obj, struct
 	if (err)
 		return err;
 
-	err = got_packidx_get_packfile_path(&path_packfile, packidx);
+	err = got_packidx_get_packfile_path(&path_packfile,
+	    packidx->path_packidx);
 	if (err)
 		return err;
 
@@ -546,7 +547,8 @@ got_object_raw_open(struct got_raw_object **obj, struc
 	if (err == NULL) {
 		struct got_pack *pack = NULL;
 
-		err = got_packidx_get_packfile_path(&path_packfile, packidx);
+		err = got_packidx_get_packfile_path(&path_packfile,
+		    packidx->path_packidx);
 		if (err)
 			goto done;
 
@@ -828,7 +830,8 @@ open_commit(struct got_commit_object **commit,
 	if (err == NULL) {
 		struct got_pack *pack = NULL;
 
-		err = got_packidx_get_packfile_path(&path_packfile, packidx);
+		err = got_packidx_get_packfile_path(&path_packfile,
+		    packidx->path_packidx);
 		if (err)
 			return err;
 
@@ -1041,7 +1044,8 @@ open_tree(struct got_tree_object **tree, struct got_re
 	if (err == NULL) {
 		struct got_pack *pack = NULL;
 
-		err = got_packidx_get_packfile_path(&path_packfile, packidx);
+		err = got_packidx_get_packfile_path(&path_packfile,
+		    packidx->path_packidx);
 		if (err)
 			return err;
 
@@ -1405,7 +1409,8 @@ open_blob(struct got_blob_object **blob, struct got_re
 	if (err == NULL) {
 		struct got_pack *pack = NULL;
 
-		err = got_packidx_get_packfile_path(&path_packfile, packidx);
+		err = got_packidx_get_packfile_path(&path_packfile,
+		    packidx->path_packidx);
 		if (err)
 			goto done;
 
@@ -1755,7 +1760,8 @@ open_tag(struct got_tag_object **tag, struct got_repos
 	if (err == NULL) {
 		struct got_pack *pack = NULL;
 
-		err = got_packidx_get_packfile_path(&path_packfile, packidx);
+		err = got_packidx_get_packfile_path(&path_packfile,
+		    packidx->path_packidx);
 		if (err)
 			return err;
 
@@ -2259,7 +2265,8 @@ got_traverse_packed_commits(struct got_object_id_queue
 		return NULL;
 	}
 
-	err = got_packidx_get_packfile_path(&path_packfile, packidx);
+	err = got_packidx_get_packfile_path(&path_packfile,
+	    packidx->path_packidx);
 	if (err)
 		return err;
 
blob - 5f8dfb856fa6b279f5a7d058b7334047642919af
blob + 9bb2b1a4ab231495841a9af5bbea8d25a8d485fa
--- lib/pack.c
+++ lib/pack.c
@@ -416,21 +416,21 @@ got_packidx_close(struct got_packidx *packidx)
 }
 
 const struct got_error *
-got_packidx_get_packfile_path(char **path_packfile, struct got_packidx *packidx)
+got_packidx_get_packfile_path(char **path_packfile, const char *path_packidx)
 {
 	size_t size;
 
 	/* Packfile path contains ".pack" instead of ".idx", so add one byte. */
-	size = strlen(packidx->path_packidx) + 2;
+	size = strlen(path_packidx) + 2;
 	if (size < GOT_PACKFILE_NAMELEN + 1)
-		return got_error_path(packidx->path_packidx, GOT_ERR_BAD_PATH);
+		return got_error_path(path_packidx, GOT_ERR_BAD_PATH);
 
 	*path_packfile = malloc(size);
 	if (*path_packfile == NULL)
 		return got_error_from_errno("malloc");
 
 	/* Copy up to and excluding ".idx". */
-	if (strlcpy(*path_packfile, packidx->path_packidx,
+	if (strlcpy(*path_packfile, path_packidx,
 	    size - strlen(GOT_PACKIDX_SUFFIX) - 1) >= size)
 		return got_error(GOT_ERR_NO_SPACE);
 
blob - 8277291379829ca0b50aa77c2ae029a90d258983
blob + 15c0782632559de89351d64aec03314766fc7a79
--- lib/repository.c
+++ lib/repository.c
@@ -1971,7 +1971,8 @@ got_repo_get_packfile_info(int *npackfiles, int *nobje
 			goto done;
 		*total_packsize += sb.st_size;
 
-		err = got_packidx_get_packfile_path(&path_packfile, packidx);
+		err = got_packidx_get_packfile_path(&path_packfile,
+		    packidx->path_packidx);
 		if (err)
 			goto done;