commit 9772fc4b6b62f40cb3134a8ada6b5592b3ce8e1d from: Omar Polo via: Thomas Adam date: Fri Jul 12 06:00:18 2024 UTC change got_imsg_painted_commit to use a object id struct ok stsp@ commit - a07b40efef09db014d4811fd1c3a2816537fb7b5 commit + 9772fc4b6b62f40cb3134a8ada6b5592b3ce8e1d blob - d8afb17835001658ab591d2eff4e0afcb93cb0b5 blob + 952f07df228ece0bf5959e243790cf8494534278 --- lib/got_lib_privsep.h +++ lib/got_lib_privsep.h @@ -354,7 +354,7 @@ struct got_imsg_commit_painting_request { /* Structure for GOT_IMSG_PAINTED_COMMITS. */ struct got_imsg_painted_commit { - uint8_t id[SHA1_DIGEST_LENGTH]; + struct got_object_id id; intptr_t color; } __attribute__((__packed__)); blob - 6c397be7643c9d3412d71efa4e16b454883b198c blob + 984cb86c8e9f5e14dd64a9d676235a77555bc510 --- lib/privsep.c +++ lib/privsep.c @@ -3427,7 +3427,7 @@ send_painted_commits(struct got_object_id_queue *ids, color = (intptr_t)qid->data; /* Keep in sync with struct got_imsg_painted_commit! */ - if (imsg_add(wbuf, qid->id.sha1, SHA1_DIGEST_LENGTH) == -1) + if (imsg_add(wbuf, &qid->id, sizeof(qid->id)) == -1) return got_error_from_errno("imsg_add PAINTED_COMMITS"); if (imsg_add(wbuf, &color, sizeof(color)) == -1) return got_error_from_errno("imsg_add PAINTED_COMMITS"); @@ -3521,7 +3521,7 @@ got_privsep_recv_painted_commits(struct got_object_id_ if (icommits.present_in_pack) { struct got_object_id id; - memcpy(id.sha1, icommit.id, SHA1_DIGEST_LENGTH); + memcpy(&id, &icommit.id, sizeof(id)); err = cb(cb_arg, &id, icommit.color); if (err) break; @@ -3530,8 +3530,8 @@ got_privsep_recv_painted_commits(struct got_object_id_ err = got_object_qid_alloc_partial(&qid); if (err) break; - memcpy(qid->id.sha1, icommit.id, - SHA1_DIGEST_LENGTH); + memcpy(&qid->id, &icommit.id, + sizeof(qid->id)); qid->data = (void *)icommit.color; STAILQ_INSERT_TAIL(new_ids, qid, entry); }