[PATCH] Lost parenthesis in a recent libXaw change

Alan Coopersmith Alan.Coopersmith at Sun.COM
Tue Oct 20 10:38:51 PDT 2009


Good catch - I only compiled with Sun cc before committing, which
doesn't issue this warning (relying on it's associated lint
program for that level of checking), and it's clear the original
contributor didn't compile his suggested patch with any compiler
before submitting, since his patch was missing a ; needed to build.

I'll push your fix now.   Sorry about that.

	-alan-

Colin Harrison wrote:
>> -----Original Message-----
>> From: Colin Harrison [mailto:colin.harrison at virgin.net] 
>> Sent: 20 October 2009 17:34
>> To: 'xorg-devel at lists.x.org'
>> Subject: PATCH Lost parenthesis in a recent libXaw change
>>
>> Hi,
>>
>> Don’t we still need the parenthesis in the recent libXaw change?
>>
>> http://lists.freedesktop.org/archives/xorg-commit/2009-October
>> /023796.html
>>
>>
>> --- ./src/save_AsciiSrc.c       2009-10-20 16:29:07.000000000 +0100
>> +++ ./src/AsciiSrc.c    2009-10-20 16:34:55.000000000 +0100
>> @@ -1292,7 +1292,7 @@
>>  {
>>      int fd;
>>
>> -    if (fd = creat(name, 0666) == -1)
>> +    if ((fd = creat(name, 0666)) == -1)
>>         return (False);
>>
>>      if (write(fd, string, length) == -1) {
>>
>> Thanks,
>> Colin
>>
> PS and the proof
> 
> #include <stdio.h>
> int main(int argc, char* argv[])
> {
> int i1, i2;
> 
> if (i1 = sizeof(int) == 4) printf ("Bad i1 = %d\n", i1);
> if ((i2 = sizeof(int)) == 4) printf ("Good i2 = %d\n", i2);
> 
> return 0;
> }
> 
> # cc -Wall test.c
> test.c: In function `main':
> test.c:6: warning: suggest parentheses around assignment used as truth value
> 
> # ./a.out
> Bad i1 = 1
> Good i2 = 4
> 
> Don't you just love C coding.
> 
> Thanks,
> Colin
> 
> _______________________________________________
> xorg-devel mailing list
> xorg-devel at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-devel

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Sun Microsystems, Inc. - X Window System Engineering



More information about the xorg-devel mailing list