Remove get_object_hash.

Convert all instances of get_object_hash to use an appropriate reference
to the hash member of the oid member of struct object.  This provides no
functional change, as it is essentially a macro substitution.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Jeff King <peff@peff.net>
This commit is contained in:
brian m. carlson
2015-11-10 02:22:29 +00:00
committed by Jeff King
parent f2fd0760f6
commit ed1c9977cb
63 changed files with 251 additions and 253 deletions

View File

@ -251,7 +251,7 @@ static void start_fetch_loose(struct transfer_request *request)
struct active_request_slot *slot;
struct http_object_request *obj_req;
obj_req = new_http_object_request(repo->url, get_object_hash(*request->obj));
obj_req = new_http_object_request(repo->url, request->obj->oid.hash);
if (obj_req == NULL) {
request->state = ABORTED;
return;
@ -304,7 +304,7 @@ static void start_fetch_packed(struct transfer_request *request)
struct transfer_request *check_request = request_queue_head;
struct http_pack_request *preq;
target = find_sha1_pack(get_object_hash(*request->obj), repo->packs);
target = find_sha1_pack(request->obj->oid.hash, repo->packs);
if (!target) {
fprintf(stderr, "Unable to fetch %s, will not be able to update server info refs\n", oid_to_hex(&request->obj->oid));
repo->can_update_info_refs = 0;
@ -361,7 +361,7 @@ static void start_put(struct transfer_request *request)
ssize_t size;
git_zstream stream;
unpacked = read_sha1_file(get_object_hash(*request->obj), &type, &len);
unpacked = read_sha1_file(request->obj->oid.hash, &type, &len);
hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
/* Set it up */
@ -533,7 +533,7 @@ static void finish_request(struct transfer_request *request)
if (request->state == RUN_MKCOL) {
if (request->curl_result == CURLE_OK ||
request->http_code == 405) {
remote_dir_exists[get_object_hash(*request->obj)[0]] = 1;
remote_dir_exists[request->obj->oid.hash[0]] = 1;
start_put(request);
} else {
fprintf(stderr, "MKCOL %s failed, aborting (%d/%ld)\n",
@ -614,7 +614,7 @@ static int fill_active_slot(void *unused)
start_fetch_loose(request);
return 1;
} else if (pushing && request->state == NEED_PUSH) {
if (remote_dir_exists[get_object_hash(*request->obj)[0]] == 1) {
if (remote_dir_exists[request->obj->oid.hash[0]] == 1) {
start_put(request);
} else {
start_mkcol(request);
@ -638,8 +638,8 @@ static void add_fetch_request(struct object *obj)
* Don't fetch the object if it's known to exist locally
* or is already in the request queue
*/
if (remote_dir_exists[get_object_hash(*obj)[0]] == -1)
get_remote_object_list(get_object_hash(*obj)[0]);
if (remote_dir_exists[obj->oid.hash[0]] == -1)
get_remote_object_list(obj->oid.hash[0]);
if (obj->flags & (LOCAL | FETCHING))
return;
@ -671,11 +671,11 @@ static int add_send_request(struct object *obj, struct remote_lock *lock)
* Don't push the object if it's known to exist on the remote
* or is already in the request queue
*/
if (remote_dir_exists[get_object_hash(*obj)[0]] == -1)
get_remote_object_list(get_object_hash(*obj)[0]);
if (remote_dir_exists[obj->oid.hash[0]] == -1)
get_remote_object_list(obj->oid.hash[0]);
if (obj->flags & (REMOTE | PUSHING))
return 0;
target = find_sha1_pack(get_object_hash(*obj), repo->packs);
target = find_sha1_pack(obj->oid.hash, repo->packs);
if (target) {
obj->flags |= REMOTE;
return 0;