On 05/03/2012 11:55 AM, Stefan Berger wrote: >> >> +#ifdef HAVE_LIBNL1 >> +#define nl_alloc nl_handle_alloc >> +#define nl_free nl_handle_destroy >> +typedef struct nl_handle nlhandle_t; >> +#else >> +#define nl_alloc nl_socket_alloc >> +#define nl_free nl_socket_free >> +typedef struct nl_sock nlhandle_t; >> +#endif >> + > > I would not #define in the namespace of that library (nl_*). Agreed that a vir* namespace is safer. > What about > the following: > #ifdef HAVE_LIBNL1 > > static struct nl_handle * > virNLHandleAlloc(void) > { > return nl_handle_alloc(); > } One further: typedef struct nl_handle virNLHandle; static virNLHandle * virNLHandleAlloc(void) ... so that the rest of the code is indeed isolated into virNL wrappers with no additional #ifdefs. -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list