[Mesa-dev] [PATCH v3 1/3] util: Add util_strncpy

Nicolai Hähnle nhaehnle at gmail.com
Mon Jul 3 10:45:52 UTC 2017


On 03.07.2017 12:44, Nicolai Hähnle wrote:
> On 03.07.2017 09:43, Gustaw Smolarczyk wrote:
>> 2017-07-03 6:10 GMT+02:00 Robert Foss <robert.foss at collabora.com>:
>>> On Sun, 2017-07-02 at 21:06 -0700, Matt Turner wrote:
>>>> Otherwise known as strlcpy()?
>>>
>>> I didn't realize this, a wrapper would be needed for all platformsou
>>> that don't support it natively.
>>>
>>> Do you know which platforms support strlcpy?
>>>
>>>
>>> Rob.
>>
>> I think various BSD variants support strlcpy ([1] as an example).
> 
> I'd suggest to keep the patches mostly the same, but rename util_strncpy 
> to util_strlcpy. That way, the name is aligned with the standard library 
> function that many platforms have, and the code is still fully portable.
> 
> Keep in mind to adjust also the commit messages when you make the change.

Of course, it would be even nicer to just rename it to strlcpy and add 
some #ifdef magic to figure out which platforms it's needed on.



> 
> Cheers,
> Nicolai
> 
> 
> 
>> Gustaw
>>
>> [1] https://www.freebsd.org/cgi/man.cgi?query=strlcpy&sektion=3
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
> 
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list