[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v3 1/7] libvirt: add new public API virConnectGetCPUModelNames



On 09/11/2013 08:12 AM, Giuseppe Scrivano wrote:
> The new function virConnectGetCPUModelNames allows to retrieve the list
> of CPU models known by the hypervisor for a specific architecture.
> 
> Signed-off-by: Giuseppe Scrivano <gscrivan redhat com>
> ---

> +int
> +virConnectGetCPUModelNames(virConnectPtr conn, const char *arch, char ***models,
> +                           unsigned int flags)
> +{
> +    VIR_DEBUG("conn=%p, arch=%s, flags=%x", conn, arch, flags);
> +    virResetLastError();
> +
> +    if (!VIR_IS_CONNECT(conn)) {
> +        virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
> +        virDispatchError(NULL);
> +        return -1;

Oh, I also missed another point of consistency with our ListAll
functions - we guarantee that if models is non-NULL, it will be
sanitized on all error paths.  Squashing this in, too:

diff --git i/src/libvirt.c w/src/libvirt.c
index b31b561..b9b9459 100644
--- i/src/libvirt.c
+++ w/src/libvirt.c
@@ -18545,6 +18545,9 @@ virConnectGetCPUModelNames(virConnectPtr conn,
const char *arch, char ***models,
     VIR_DEBUG("conn=%p, arch=%s, flags=%x", conn, arch, flags);
     virResetLastError();

+    if (models)
+        *models = NULL;
+
     if (!VIR_IS_CONNECT(conn)) {
         virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         virDispatchError(NULL);


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]