[Xcb] [PATCH v2 1/2] [libXau] XauGetFileName: added a thread-safe variant of XauFileName
Mark Kettenis
mark.kettenis at xs4all.nl
Thu Mar 31 06:13:47 PDT 2011
> From: =?UTF-8?q?Erkki=20Sepp=C3=A4l=C3=A4?= <erkki.seppala at vincit.fi>
> Date: Wed, 30 Mar 2011 11:53:53 +0300
>
> XauGetFileName has argument char **buffer, which can be used to
> provide an existing buffer for XauGetFileName to store the result
> in. *buffer can be NULL, in which case a newly allocated block of
> memory will be allocated and stored at *buffer.
Sorry, but I think that is a bad API. It will lead to confusion
who allocated the buffer.
Also somebody noted that that the only external program thet uses
XauFileName(3) is xauth(1). So I think there is no good reason to
export the new thread-safe interface and only use it internally. That
makes my criticism about the chosen API less important, so feel free
to ignore those objections if you decide not to export this new interface.
> NetBSD getenv_r is also supported. Unfortunately this support has only
> been tested with a simulation function under Linux, as I don't have
> access to a NetBSD host, and neither FreeBSD nor Solaris provide this
> function. Linux getenv is already thread safe (assuming environment is
> not changed), as it simply returns a pointer inside the environment in
> process address space. Also Solaris getenv is thread safe according to
> its documentation.
See my other diff about why I don't think supporting the NetBSD
getenv_r(3) is worth it.
More information about the Xcb
mailing list