Re: [PATCH v5 00/11] Deprecate .git/info/grafts

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

 



Hi Junio,

On Thu, 26 Apr 2018, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@xxxxxx> writes:
> 
> >  -	if (export_object(&old_oid, type, raw, tmpfile))
> >  -		return -1;
> >  -	if (launch_editor(tmpfile, NULL, NULL) < 0)
> >  -		return error("editing object file failed");
> >  -	if (import_object(&new_oid, type, raw, tmpfile))
> >  +	tmpfile = git_pathdup("REPLACE_EDITOBJ");
> >  +	if (export_object(&old_oid, type, raw, tmpfile) ||
> >  +	    (launch_editor(tmpfile, NULL, NULL) < 0 &&
> >  +	     error("editing object file failed")) ||
> >  +	    import_object(&new_oid, type, raw, tmpfile)) {
> >  +		free(tmpfile);
> >   		return -1;
> >  -
> >  +	}
> 
> I know the above is to avoid leaking tmpfile, but a single if ()
> condition that makes multiple calls to functions primarily for their
> side effects is too ugly to live.

I changed it back to individual conditional blocks, with every single one
of them having their own free(tmpfile). That is at least clearer.

Ciao,
Dscho



[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