
On Fri, Feb 22, 2008 at 02:58:36PM +0100, Jim Meyering wrote:
Move safewrite and saferead to a separate file.
We currently use safewrite from inside libvirt and don't want to publish any such function name. However, we do want to use it in applications like virsh, libvirtd and libvirt_proxy that link with libvirt. To that end, this change moves that function definition (along with the nearly identical saferead) into a new file, util-lib.c. To avoid maintaining separate copies of even such small functions, we simply include that new file from util.c. Then, the separate applications that need to use safewrite simply compile and link with util-lib.c.
I realized this morning that as is this didn't worked well if virsh was compiled against a static version of the library, since the function would be redefined and an error shows up at link time. The enclosed patch is the simplest we could find with Jim to solve the issue, it just renames the safe function when compiled inside the library, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/