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

Re: [libvirt] [PATCH 07/24] maint: avoid nested public calls



On 01/02/2014 12:50 PM, John Ferlan wrote:
> 
> 
> On 12/28/2013 11:11 AM, Eric Blake wrote:
>> Having one API call into another is generally not good; among
>> other issues, it gives confusing logs, and is not quite as
>> efficient.
>>

>> * src/libvirt.c (virDomainGetUUIDString, virNetworkGetUUIDString)
>> (virStoragePoolGetUUIDString, virSecretGetUUIDString)
>> (virNWFilterGetUUIDString): Avoid nested public API call.
>> * src/util/virtypedparam.c (virTypedParamsReplaceString): Don't
>> dispatch errors here.
>> (virTypedParamsGet): No need to reset errors.
>>

> 
> ACK
> 
> Although I do note that virTypedParamsGetBoolean() has a slightly
> different call flow than other similar functions...

Sure, I can fix that.  Here's what I squashed when pushing.

diff --git i/src/util/virtypedparam.c w/src/util/virtypedparam.c
index 26fb78c..7e8ea7f 100644
--- i/src/util/virtypedparam.c
+++ w/src/util/virtypedparam.c
@@ -1,7 +1,7 @@
 /*
  * virtypedparam.c: utility functions for dealing with virTypedParameters
  *
- * Copyright (C) 2011-2013 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
@@ -668,11 +668,11 @@ virTypedParamsGetBoolean(virTypedParameterPtr params,
 {
     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;


-- 
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]