walter harms wrote:
> 
> Am 05.12.2010 18:51, schrieb Alan Coopersmith:
> 
>>>> diff --git a/hw/xfree86/common/xf86ShowOpts.c 
>>>> b/hw/xfree86/common/xf86ShowOpts.c
>>>> index ce86090..c0fa80a 100644
>>>> --- a/hw/xfree86/common/xf86ShowOpts.c
>>>> +++ b/hw/xfree86/common/xf86ShowOpts.c
>>>> @@ -97,11 +97,8 @@ void DoShowOptions (void) {
>>>>                            );
>>>>                            continue;                                       
>>>>                 
>>>>                    }
>>>> -                  pSymbol = malloc(
>>>> -                          strlen(xf86DriverList[i]->driverName) + 
>>>> strlen("ModuleData") + 1
>>>> -                  );
>>>> -                  strcpy (pSymbol, xf86DriverList[i]->driverName);
>>>> -                  strcat (pSymbol, "ModuleData");
>>>> +                  XNFasprintf(&pSymbol, "%sModuleData",
>>>> +                              xf86DriverList[i]->driverName);
>>>
>>> every code before checks the return value of asprintf but not here ?
>> We don't need to know the length, and error is not an option from the XNF*
>> variants - they either succeed or cause the server to abort.   I used the
>> XNF* here since if the malloc failed, previously the server exited, just
>> going through the sigsegv handler instead of a cleaner AbortServer().
>> (NF is "No Fail")
>>
> 
> 
> mmh, so XNFasprintf() could be void instead of int ?

If we were sure that no caller would ever want the returned string length - but
we're not, and that would be a needless change from the normal asprintf() API.

-- 
        -Alan Coopersmith-        [email protected]
         Oracle Solaris Platform Engineering: X Window System

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to