[PATCH 1/6 v2] Add X*asprintf() routines to mirror common asprintf() routines

Alan Coopersmith alan.coopersmith at oracle.com
Thu Dec 2 19:49:21 PST 2010


Keith Packard wrote:
> On Tue, 30 Nov 2010 21:53:26 -0800, Alan Coopersmith <alan.coopersmith at oracle.com> wrote:
> 
>> Provides a portable implementation of this common allocating sprintf()
>> API found in many, but not yet all, of the platforms we support.
>> If the platform provides vasprintf() we simply wrap it, otherwise we
>> implement it - either way callers can use it regardless of platform.
> 
> I didn't see any closure to my question as to whether we should just be
> exporting these as 'asprintf' et al., instead of creating a new name.
> 
> Do we trust autoconf enough to expect to be able to correctly detect the
> presence of a 'real' asprintf so that our replacement only be used on
> systems not having one? If so, perhaps just using the standard name
> would make the code easier to maintain? Or not?

That's one of the reasons I hadn't included that portion of the series in
the patches in my recent pull request.

I think it's safe to trust autoconf to do the right thing if we only care
about using the code in the server tree and not making it available to
drivers, since we already do that with the os/str*.c replacements.

It's the exporting as part of driver ABI I worry about.

At least in the drivers I have git cloned locally (most of the non-dead
x86 ones), I see no existing uses of Xprintf, nor does elfdump see it in the
nvidia_drv.so for Solaris (which means we could probably skip over deprecation
and move straight to deletion).

I do see lots of calls to sprintf, but I suppose drivers who care can
also have a local autoconf replacement of asprintf() instead of putting
it in the server-exported ABI.

Would that be the best answer then?   Should the asprintf() replacement
just become _X_HIDDEN and link os/Xprintf.c into any module that calls
it?   Right now, it looks like libvbe.so is the only caller outside the
main server binary, and it calls XNFasprintf, which would be exported
ABI either way.

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



More information about the xorg-devel mailing list