[libvirt] [PATCH 1/2] event: fix doc typos, and doc more public methods

Eric Blake eblake at redhat.com
Thu Jan 2 20:56:13 UTC 2014


On 01/02/2014 09:32 AM, Eric Blake wrote:
> While working on events, I found a number of minor issues; I'm
> hoisting these to the front rather than doing it piecemeal in
> the patches where I first noticed bad or missing documentation.
> 
> * src/conf/object_event.c: Fix grammar, document all parameters
> of public functions; wrap some long lines.
> * src/conf/object_event.h: Likewise.
> * src/conf/network_event.c: Likewise.
> * src/conf/domain_event.c: Likewise (except for the large number
> of event creation functions).
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  src/conf/domain_event.c  | 64 +++++++++++++++++++++++++--------------
>  src/conf/network_event.c | 26 +++++++++++-----
>  src/conf/object_event.c  | 78 +++++++++++++++++++++++++++++++++++++++++++-----
>  src/conf/object_event.h  |  7 +++--
>  4 files changed, 134 insertions(+), 41 deletions(-)

And squashing in this use of bool (hmm, once again pasting in causes
line wrapping :( )

diff --git c/src/conf/object_event.c w/src/conf/object_event.c
index eca6a10..bbf1972 100644
--- c/src/conf/object_event.c
+++ w/src/conf/object_event.c
@@ -589,33 +589,29 @@ virObjectEventQueuePush(virObjectEventQueuePtr
evtQueue,
 }


-static int
+static bool
 virObjectEventDispatchMatchCallback(virObjectEventPtr event,
                                     virObjectEventCallbackPtr cb)
 {
     if (!cb)
-        return 0;
+        return false;
     if (cb->deleted)
-        return 0;
+        return false;
     if (!virObjectIsClass(event, cb->klass))
-        return 0;
+        return false;
     if (cb->eventID != virObjectEventGetEventID(event))
-        return 0;
+        return false;

     if (cb->meta) {
         /* Deliberately ignoring 'id' for matching, since that
          * will cause problems when a domain switches between
          * running & shutoff states & ignoring 'name' since
          * Xen sometimes renames guests during migration, thus
-         * leaving 'uuid' as the only truly reliable ID we can use*/
-
-        if (memcmp(event->meta.uuid, cb->meta->uuid, VIR_UUID_BUFLEN) == 0)
-            return 1;
+         * leaving 'uuid' as the only truly reliable ID we can use. */

-        return 0;
-    } else {
-        return 1;
+        return memcmp(event->meta.uuid, cb->meta->uuid,
VIR_UUID_BUFLEN) == 0;
     }
+    return true;
 }


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140102/27ef112d/attachment-0001.sig>


More information about the libvir-list mailing list