int
virDomainGetUUIDString(virDomainPtr domain, char *buf)
{
- unsigned char uuid[VIR_UUID_BUFLEN];
-
VIR_DOMAIN_DEBUG(domain, "buf=%p", buf);
virResetLastError();
}
virCheckNonNullArgGoto(buf, error);
- if (virDomainGetUUID(domain, &uuid[0]))
- goto error;
-
- virUUIDFormat(uuid, buf);
+ virUUIDFormat(domain->uuid, buf);
return 0;
error:
int
virNetworkGetUUIDString(virNetworkPtr network, char *buf)
{
- unsigned char uuid[VIR_UUID_BUFLEN];
VIR_DEBUG("network=%p, buf=%p", network, buf);
virResetLastError();
}
virCheckNonNullArgGoto(buf, error);
- if (virNetworkGetUUID(network, &uuid[0]))
- goto error;
-
- virUUIDFormat(uuid, buf);
+ virUUIDFormat(network->uuid, buf);
return 0;
error:
virStoragePoolGetUUIDString(virStoragePoolPtr pool,
char *buf)
{
- unsigned char uuid[VIR_UUID_BUFLEN];
VIR_DEBUG("pool=%p, buf=%p", pool, buf);
virResetLastError();
}
virCheckNonNullArgGoto(buf, error);
- if (virStoragePoolGetUUID(pool, &uuid[0]))
- goto error;
-
- virUUIDFormat(uuid, buf);
+ virUUIDFormat(pool->uuid, buf);
return 0;
error:
int
virSecretGetUUIDString(virSecretPtr secret, char *buf)
{
- unsigned char uuid[VIR_UUID_BUFLEN];
VIR_DEBUG("secret=%p, buf=%p", secret, buf);
virResetLastError();
}
virCheckNonNullArgGoto(buf, error);
- if (virSecretGetUUID(secret, &uuid[0]))
- goto error;
-
- virUUIDFormat(uuid, buf);
+ virUUIDFormat(secret->uuid, buf);
return 0;
error:
int
virNWFilterGetUUIDString(virNWFilterPtr nwfilter, char *buf)
{
- unsigned char uuid[VIR_UUID_BUFLEN];
VIR_DEBUG("nwfilter=%p, buf=%p", nwfilter, buf);
virResetLastError();
}
virCheckNonNullArgGoto(buf, error);
- if (virNWFilterGetUUID(nwfilter, &uuid[0]))
- goto error;
-
- virUUIDFormat(uuid, buf);
+ virUUIDFormat(nwfilter->uuid, buf);
return 0;
error:
/*
* virtypedparam.c: utility functions for dealing with virTypedParameters
*
- * Copyright (C) 2011-2012 Red Hat, Inc.
+ * Copyright (C) 2011-2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
"boolean",
"string")
+/* When editing this file, ensure that public exported functions
+ * (those in libvirt_public.syms) either trigger no errors, or else
+ * reset error on entrance and call virDispatchError() on exit; while
+ * internal utility functions (those in libvirt_private.syms) may
+ * report errors that the caller will dispatch. */
+
/* Validate that PARAMS contains only recognized parameter names with
* correct types, and with no duplicates. Pass in as many name/type
* pairs as appropriate, and pass NULL to end the list of accepted
size_t n = *nparams;
virTypedParameterPtr param;
- virResetLastError();
-
param = virTypedParamsGet(*params, n, name);
if (param) {
if (param->type != VIR_TYPED_PARAM_STRING) {
return 0;
error:
- virDispatchError(NULL);
return -1;
}
* Finds typed parameter called @name.
*
* Returns pointer to the parameter or NULL if it does not exist in @params.
+ * This function does not raise an error, even when returning NULL.
*/
virTypedParameterPtr
virTypedParamsGet(virTypedParameterPtr params,
{
size_t i;
- virResetLastError();
+ /* No need to reset errors, since this function doesn't report any. */
if (!params || !name)
return NULL;
{
virTypedParameterPtr param;
+ virResetLastError();
+
if (!(param = virTypedParamsGet(params, nparams, name)))
return 0;
- virResetLastError();
-
VIR_TYPED_PARAM_CHECK_TYPE(VIR_TYPED_PARAM_BOOLEAN);
if (value)
*value = !!param->value.b;