commit 740e7917ac3f37feb39510c99a184089bd22f519 from: Omar Polo date: Wed Jul 10 08:04:04 2024 UTC change got_imsg_painted_commit to use a object id struct ok stsp@ commit - 1b1a386df9068b7cb3ceb8a67d88ccd24f5b2deb commit + 740e7917ac3f37feb39510c99a184089bd22f519 blob - 96ea6e4692bb24d2f128702524fea15db694ddb5 blob + 86c780f1b39bd6593b1deb94215ecf9405b05740 --- 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 - 0ca99e2d0f60973cd9f9304f89eb72f756cc520b blob + 337a7e73209bcce74e47b6f588ebc9eef0119ae9 --- 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); }