remove obj->path_packfile which is unused nowadays; saves a few free() calls
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
diff --git a/lib/got_lib_object.h b/lib/got_lib_object.h
index f09d092..4894337 100644
--- a/lib/got_lib_object.h
+++ b/lib/got_lib_object.h
@@ -29,7 +29,6 @@ struct got_object {
size_t size;
struct got_object_id id;
- char *path_packfile; /* if packed */
int pack_idx; /* if packed */
off_t pack_offset; /* if packed */
struct got_delta_chain deltas; /* if deltified */
diff --git a/lib/object.c b/lib/object.c
index c6bef75..743225b 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -196,11 +196,6 @@ request_packed_object(struct got_object **obj, struct got_pack *pack, int idx,
if (err)
return err;
- (*obj)->path_packfile = strdup(pack->path_packfile);
- if ((*obj)->path_packfile == NULL) {
- err = got_error_from_errno("strdup");
- return err;
- }
memcpy(&(*obj)->id, id, sizeof((*obj)->id));
return NULL;
@@ -325,7 +320,7 @@ open_packed_object(struct got_object **obj, struct got_object_id *id,
if (err)
goto done;
- err = got_repo_cache_pack(NULL, repo, (*obj)->path_packfile, packidx);
+ err = got_repo_cache_pack(NULL, repo, path_packfile, packidx);
done:
free(path_packfile);
return err;
diff --git a/lib/object_cache.c b/lib/object_cache.c
index c67ff75..db4481b 100644
--- a/lib/object_cache.c
+++ b/lib/object_cache.c
@@ -77,9 +77,6 @@ get_size_obj(struct got_object *obj)
size_t size = sizeof(*obj);
struct got_delta *delta;
- if (obj->flags & GOT_OBJ_FLAG_PACKED)
- size += strlen(obj->path_packfile);
-
if ((obj->flags & GOT_OBJ_FLAG_DELTIFIED) == 0)
return size;
diff --git a/lib/object_parse.c b/lib/object_parse.c
index 9124070..2c6c9f8 100644
--- a/lib/object_parse.c
+++ b/lib/object_parse.c
@@ -117,8 +117,6 @@ got_object_close(struct got_object *obj)
free(delta);
}
}
- if (obj->flags & GOT_OBJ_FLAG_PACKED)
- free(obj->path_packfile);
free(obj);
}
diff --git a/lib/pack.c b/lib/pack.c
index eef27b8..76e9329 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -611,21 +611,13 @@ parse_object_type_and_size(uint8_t *type, uint64_t *size, size_t *len,
}
static const struct got_error *
-open_plain_object(struct got_object **obj, const char *path_packfile,
- struct got_object_id *id, uint8_t type, off_t offset, size_t size, int idx)
+open_plain_object(struct got_object **obj, struct got_object_id *id,
+ uint8_t type, off_t offset, size_t size, int idx)
{
*obj = calloc(1, sizeof(**obj));
if (*obj == NULL)
return got_error_from_errno("calloc");
- (*obj)->path_packfile = strdup(path_packfile);
- if ((*obj)->path_packfile == NULL) {
- const struct got_error *err = got_error_from_errno("strdup");
- free(*obj);
- *obj = NULL;
- return err;
- }
-
(*obj)->type = type;
(*obj)->flags = GOT_OBJ_FLAG_PACKED;
(*obj)->pack_idx = idx;
@@ -919,12 +911,6 @@ open_delta_object(struct got_object **obj, struct got_packidx *packidx,
SIMPLEQ_INIT(&(*obj)->deltas.entries);
(*obj)->flags |= GOT_OBJ_FLAG_DELTIFIED;
-
- (*obj)->path_packfile = strdup(pack->path_packfile);
- if ((*obj)->path_packfile == NULL) {
- err = got_error_from_errno("strdup");
- goto done;
- }
(*obj)->flags |= GOT_OBJ_FLAG_PACKED;
(*obj)->pack_idx = idx;
@@ -970,8 +956,8 @@ got_packfile_open_object(struct got_object **obj, struct got_pack *pack,
case GOT_OBJ_TYPE_TREE:
case GOT_OBJ_TYPE_BLOB:
case GOT_OBJ_TYPE_TAG:
- err = open_plain_object(obj, pack->path_packfile, id, type,
- offset + tslen, size, idx);
+ err = open_plain_object(obj, id, type, offset + tslen,
+ size, idx);
break;
case GOT_OBJ_TYPE_OFFSET_DELTA:
case GOT_OBJ_TYPE_REF_DELTA: