bug-diffutils
[Top][All Lists]
Advanced

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

Re: [bug-diffutils] [PATCH] diff: Encode file names with special charact


From: Paul Eggert
Subject: Re: [bug-diffutils] [PATCH] diff: Encode file names with special characters
Date: Mon, 10 Sep 2012 14:00:39 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/10/2012 05:42 AM, Jim Meyering wrote:
> -  sprintf (name, "diff%s %s %s", switch_string, names[0], names[1]);
> +  name = xasprintf ("diff%s %s %s", switch_string, names[0], names[1]);
> 
>    if (paginate)

Could I suggest migrating that assignment to 'name'
so that it's inside the then-part of the 'if (paginate)'?
That way, the else-part can call printf instead of
xasprintf, without worrying about memory allocation,
and the memory allocation is needed only in the rare
case when the --paginate option is used.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]