
On 05/24/2010 09:27 PM, Stefan Berger wrote:
Eduardo Otubo <otubo@linux.vnet.ibm.com> wrote on 05/18/2010 05:01:40 PM:
Please respond to otubo
On 05/14/2010 05:27 PM, Stefan Berger wrote:
+ +virStoragePoolPtr +phypSPLookupByName(virConnectPtr conn, const char *sp_name) +{ + virStoragePoolPtr sp = NULL; + int sp_id = 0; + unsigned char sp_uuid[VIR_UUID_BUFLEN]; + + sp_id = phypGetStoragePoolID(sp_name, conn); + if (sp_id == -1) + return NULL; + + if (phypGetStoragePoolUUID(sp_uuid, sp_name, conn) == -1) + return NULL; + + sp = virGetStoragePool(conn, sp_name, sp_uuid); + + if (sp) + return sp; + else + return NULL;
Doesn't seem necessary to do if - then here.
Just a 'return sp;' should do the trick.
Above the old.
I am sorry, I mistakenly attached an outdated patch. I am working on a final version of this patch with all the storage functions implemented. And all this minor issues will be fixed. BTW, the *char_ptr you asked to remove (and replace it with NULL) broke the driver. The virStrToLong_i checks for error on src/util/util.c:1988 and if **end_ptr is NULL, then err will not be NULL, making the function return -1. So I put the *char_ptr back. []'s -- Eduardo Otubo Software Engineer Linux Technology Center IBM Systems & Technology Group Mobile: +55 19 8135 0885 eotubo@linux.vnet.ibm.com