[PATCH 07/11] Convert existing Xprintf style calls to Xasprintf style

Alan Coopersmith alan.coopersmith at oracle.com
Tue Nov 30 16:03:15 PST 2010


Julien Cristau wrote:
> On Mon, Nov 29, 2010 at 20:57:44 -0800, Alan Coopersmith wrote:
> 
>> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
>> ---
>>  config/hal.c                       |    4 +++-
>>  config/udev.c                      |   14 ++++++++------
>>  dix/dixfonts.c                     |    4 +++-
>>  hw/xfree86/common/xf86AutoConfig.c |    4 ++--
>>  hw/xfree86/common/xf86Config.c     |    7 +++----
>>  hw/xfree86/common/xf86Helper.c     |   10 +++++++---
>>  hw/xfree86/modes/xf86Modes.c       |    4 ++--
>>  hw/xwin/win.h                      |    7 ++++---
>>  hw/xwin/windialogs.c               |    5 ++---
>>  hw/xwin/winerror.c                 |   23 ++++++++++++++---------
>>  xkb/ddxList.c                      |   23 +++++++++++++++--------
>>  xkb/ddxLoad.c                      |    8 +++++---
>>  12 files changed, 68 insertions(+), 45 deletions(-)
>>
> Reviewed-by: Julien Cristau <jcristau at debian.org>
> 
> One style comment below..
> 
>> diff --git a/xkb/ddxList.c b/xkb/ddxList.c
>> index c1ada5c..1038923 100644
>> --- a/xkb/ddxList.c
>> +++ b/xkb/ddxList.c
>> @@ -156,34 +156,41 @@ char	tmpname[PATH_MAX];
>>  #endif
>>      if (XkbBaseDirectory!=NULL) {
>>  	if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
>> -	    buf = Xprintf("%s/%s.dir",XkbBaseDirectory,componentDirs[what]);
>> -	    in= fopen(buf,"r");
>> +	    if (Xasprintf(&buf, "%s/%s.dir", XkbBaseDirectory,
>> +			  componentDirs[what]) == -1)
>> +		buf = NULL;
>> +	    else
>> +		in = fopen(buf,"r");
>>  	}
>>  	if (!in) {
>>  	    haveDir= FALSE;
>>  	    free(buf);
>> -	    buf = Xprintf(
>> +	    if (Xasprintf(&buf,
>>  		"'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
>>                  XkbBinDirectory,XkbBaseDirectory,componentDirs[what],(long)
>>  		((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
>>  		file W32_tmpfile
>> -                );
>> +		    ) == -1)
>> +		buf = NULL;
> 
> Formatting here looks kind of ugly.  Then again it's xkb.

Yeah, it was awful to begin with, but I suppose it would be better to at least
align the body of the asprintf calls.  Will fix in v2.

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list