2011/4/14 Eric Blake <eblake@xxxxxxxxxx>: > Rather than copying and pasting lots of code, factor it into a > single helper function. > > * src/phyp/phyp_driver.c (phypExecInt): New function. > (phypGetVIOSPartitionID, phypNumDomainsGeneric, phypGetLparID) > (phypGetLparMem, phypGetLparCPUGeneric, phypGetRemoteSlot) > (phypGetVIOSNextSlotNumber, phypAttachDevice) > (phypGetStoragePoolSize, phypStoragePoolNumOfVolumes) > (phypNumOfStoragePools, phypInterfaceDestroy) > (phypInterfaceDefineXML, phypInterfaceLookupByName) > (phypInterfaceIsActive, phypNumOfInterfaces): Use it. > --- > Âsrc/phyp/phyp_driver.c | Â316 ++++++++++-------------------------------------- > Â1 files changed, 67 insertions(+), 249 deletions(-) > > diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c > index bc24b76..98d5cd6 100644 > --- a/src/phyp/phyp_driver.c > +++ b/src/phyp/phyp_driver.c > @@ -228,6 +228,26 @@ phypExecBuffer(LIBSSH2_SESSION *session, virBufferPtr buf, int *exit_status, > Â Â return ret; > Â} > > +/* Convenience wrapper function */ > +static int phypExecInt(LIBSSH2_SESSION *, virBufferPtr, virConnectPtr, int *) > + Â ÂATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4); > +static int > +phypExecInt(LIBSSH2_SESSION *session, virBufferPtr buf, virConnectPtr conn, > + Â Â Â Â Â Âint *result) > +{ > + Â Âchar *str; > + Â Âint ret; > + > + Â Âstr = phypExecBuffer(session, buf, &ret, conn, true); > + Â Âif (!str || ret) { > + Â Â Â ÂVIR_FREE(str); > + Â Â Â Âreturn -1; > + Â Â} > + Â Âret = virStrToLong_i(str, NULL, 10, result); You made the parsing stricter by passing NULL as second argument to virStrToLong_i. I don't expect it but this might be possible that this breaks the behavior of the driver. > + Â ÂVIR_FREE(str); > + Â Âreturn ret; > +} > + The rest of the patch looks fine. Matthias -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list