[PATCH 7/7] Fix gcc -Wwrite-strings warnings in xf86Modes code

Alan Coopersmith alan.coopersmith at oracle.com
Wed Nov 9 16:47:39 PST 2011


On 11/09/11 05:54, walter harms wrote:
>> -static char *direction[4] = {
>> +static const char *direction[4] = {
>>       "normal",
>>       "left",
>>       "inverted",
>
>
> just nit picking:
>   this would be more consistent e.g with below.
>
>     static const char *direction[]= {

Perhaps, though the number of connection types is more likely to grow than the
number of directions.   I don't really think that's worth worrying about though.

>> diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
>> index dcd3a28..49cc149 100644
>> --- a/hw/xfree86/modes/xf86Modes.c
>> +++ b/hw/xfree86/modes/xf86Modes.c
>> @@ -272,7 +272,7 @@ xf86ModesEqual(const DisplayModeRec *pMode1, const DisplayModeRec *pMode2)
>>   }
>>
>>   static void
>> -add(char **p, char *new)
>> +add(char **p, const char *new)
>>   {
>>       *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2);
>>       strcat(*p, " ");
>
> 	this looks like a case for asprintf()

Yes it does, though that wouldn't belong in this patch, since it has nothing
to do with clearing the -Wwrite-strings warnings.   Separate patch to come.

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



More information about the xorg-devel mailing list