Re: [PATCH v2 2/3] notes.c: fixed tip when target and append note are both empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 07 2022, Taylor Blau wrote:

> On Mon, Nov 07, 2022 at 03:40:03PM +0100, Ævar Arnfjörð Bjarmason wrote:
>> > @@ -567,9 +567,15 @@ static int append_edit(int argc, const char **argv, const char *prefix)
>> >  	struct notes_tree *t;
>> >  	struct object_id object, new_note;
>> >  	const struct object_id *note;
>> > -	char *logmsg;
>> > +	char *logmsg = NULL;
>> >  	const char * const *usage;
>> > -	struct note_data d = { 0, 0, NULL, STRBUF_INIT };
>> > +	struct note_data d = {
>> > +		.given = 0,
>> > +		.use_editor = 0,
>> > +		.edit_path = NULL,
>>
>> Most of this is an unrelated "use designated init" cleanup, which is
>> good, but let's do that in a different commit if we need it. And then
>> you can drop all of these...
>>
>> > +		.buf = STRBUF_INIT
>>
>> ...and only need to keep this one.
>
> I don't mind seeing the cleanup here, but I don't see why we need to
> keep that portion of the hunk at all for this series.
>
> IOW, your "...and only need to keep this one" does not make sense to me.

I was still on my initial read-through, and was assuming that it was a
prep change for the 3/3 adding a new field, before I saw the 3/3...

> Changing "char *logmsg" to be initialized to NULL is important, though,
> since we now only set it conditionally still free it unconditionally. So
> that should be kept.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux