On Thu, May 25, 2017 at 15:57:10 -0400, John Ferlan wrote: > Since the @def is consumed by the assignment function, let's pass by > reference instead of value and really consume it. > > Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> > --- > src/conf/virnodedeviceobj.c | 8 ++++---- > src/conf/virnodedeviceobj.h | 2 +- > src/node_device/node_device_hal.c | 2 +- > src/node_device/node_device_udev.c | 8 +++----- > src/test/test_driver.c | 5 ++--- > 5 files changed, 11 insertions(+), 14 deletions(-) > > diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c > index a7e51ef..1648b33 100644 > --- a/src/conf/virnodedeviceobj.c > +++ b/src/conf/virnodedeviceobj.c > @@ -268,13 +268,13 @@ virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs) > > virNodeDeviceObjPtr > virNodeDeviceObjAssignDef(virNodeDeviceObjListPtr devs, > - virNodeDeviceDefPtr def) > + virNodeDeviceDefPtr *def) I don't really like this. You can documment that this function either consumes def always or only on success and the callers can free the pointer. Passing the pointer to a pointer just to clear it in some cases is overcomplicating stuff.
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list