builtin/notes: convert static functions to object_id
Convert the remaining static functions to take pointers to struct object_id. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Mar 12, 2018 at 02:27 UTC
e8adba25ff74f2cb95f480a86063190c0fb57ec2
1 file changed
+5
-5
builtin/notes.c
+5
-5
@@ -118,11 +118,11 @@ static int list_each_note(const struct object_id *object_oid,
118
return 0;
119
}
120
121
-static void copy_obj_to_fd(int fd, const unsigned char *sha1)
121
+static void copy_obj_to_fd(int fd, const struct object_id *oid)
122
{
123
unsigned long size;
124
enum object_type type;
125
- char *buf = read_sha1_file(sha1, &type, &size);
125
+ char *buf = read_sha1_file(oid->hash, &type, &size);
126
if (buf) {
127
if (size)
128
write_or_die(fd, buf, size);
@@ -162,7 +162,7 @@ static void write_commented_object(int fd, const struct object_id *object)
162
}
163
164
static void prepare_note_data(const struct object_id *object, struct note_data *d,
165
- const unsigned char *old_note)
165
+ const struct object_id *old_note)
166
{
167
if (d->use_editor || !d->given) {
168
int fd;
@@ -457,7 +457,7 @@ static int add(int argc, const char **argv, const char *prefix)
457
oid_to_hex(&object));
458
}
459
460
- prepare_note_data(&object, &d, note ? note->hash : NULL);
460
+ prepare_note_data(&object, &d, note);
461
if (d.buf.len || allow_empty) {
462
write_note_data(&d, &new_note);
463
if (add_note(t, &object, &new_note, combine_notes_overwrite))
@@ -602,7 +602,7 @@ static int append_edit(int argc, const char **argv, const char *prefix)
602
t = init_notes_check(argv[0], NOTES_INIT_WRITABLE);
603
note = get_note(t, &object);
604
605
- prepare_note_data(&object, &d, edit && note ? note->hash : NULL);
605
+ prepare_note_data(&object, &d, edit && note ? note : NULL);
606
607
if (note && !edit) {
608
/* Append buf to previous note contents */