On Tue, Aug 21, 2012 at 05:18:29PM +0800, Hu Tao wrote: > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c > index 56ee4c9..ff27bc7 100644 > --- a/src/conf/domain_conf.c > +++ b/src/conf/domain_conf.c > @@ -1505,7 +1505,39 @@ virDomainClockDefClear(virDomainClockDefPtr def) > VIR_FREE(def->timers); > } > > -static void > +virDomainVcpuPinDefPtr * > +virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin) > +{ > + int i = 0; > + virDomainVcpuPinDefPtr *ret; > + > + if (VIR_ALLOC_N(ret, nvcpupin) < 0) { > + goto nomem; > + } Libvirt standard practice is to use 'no_memory' for the label label in this scenario. Also you don't need {} around a single line if() > + > + for (i = 0; i < nvcpupin; i++) { > + if (VIR_ALLOC(ret[i]) < 0) > + goto nomem; > + if (VIR_ALLOC_N(ret[i]->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0) > + goto nomem; > + ret[i]->vcpuid = src[i]->vcpuid; > + memcpy(ret[i]->cpumask, src[i]->cpumask, VIR_DOMAIN_CPUMASK_LEN); > + } > + > + return ret; > + > +nomem: > + while (i >= 0) { > + VIR_FREE(ret[i]->cpumask); > + VIR_FREE(ret[i]); > + } > + VIR_FREE(ret); > + virReportOOMError(); > + > + return NULL; > +} > + > +void > virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr *def, > int nvcpupin) > { ACK with the label rename Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list