Matt Turner wrote:
>> @@ -426,13 +425,9 @@ char *
>> xf86uLongToString(unsigned long i)
>> {
>> char *s;
>> - int l;
>>
>> - l = ceil(log10((double)i) + 2.5);
>> - s = malloc(l);
>> - if (!s)
>> + if (Xasprintf(&s, "%lu", i) == -1)
>> return NULL;
>> - sprintf(s, "%lu", i);
>> return s;
>> }
>
> xf86uLongToString kind of looks useless. It's only used in
> hw/xfree86/parser/Pointer.c (seven times). It's part of the ABI, but
> can't we kill it off? I quick glance at drivers didn't show any users.
It certainly seems like it was more useful in a world before Xprintf,
and could easily be replaced by Xasprintf() going forward.
(The length calculation in the original code still hurts my head.
I understand it, but I am very happy to hide that below the
abstraction level of asprintf().)
--
-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