qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 3/3] qobject: replace qobject_incref/QINCREF qob


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 3/3] qobject: replace qobject_incref/QINCREF qobject_decref/QDECREF
Date: Wed, 21 Mar 2018 09:28:33 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 03/21/2018 08:40 AM, Marc-André Lureau wrote:
Now that we can safely call QOBJECT() on QObject * and children types,
we can have a single macro to ref/unref the object.

Change the incref/decref prefix name for the more common ref/unref.

I know you did this by sed (for the most part); but it would be worth including the command line you used in the commit message to make it easier to reproduce the same mechanical portion of the patch when rebasing.


Signed-off-by: Marc-André Lureau <address@hidden>
---

+++ b/include/qapi/qmp/qobject.h

@@ -74,13 +74,16 @@ qobject_unknown_type(const void *unused)
      (const QObject *, x),                       \
      qobject_unknown_type(x))
-/* High-level interface for qobject_incref() */
-#define QINCREF(obj)      \
-    qobject_incref(QOBJECT(obj))
+/**
+ * qobject_ref(): Increment QObject's reference count
+ */
+#define qobject_ref(x) qobject_ref_impl(QOBJECT(x))

The meat of the patch; looks fine to me.

+++ b/scripts/coccinelle/qobject.cocci
@@ -3,11 +3,11 @@
  expression Obj, Key, E;
  @@
  (
-- qobject_incref(QOBJECT(E));
-+ QINCREF(E);
+- qobject_ref(QOBJECT(E));
++ qobject_ref(E);
  |
-- qobject_decref(QOBJECT(E));
-+ QDECREF(E);
+- qobject_unref(QOBJECT(E));
++ qobject_unref(E);

I wonder if these branches should just be removed; they made sense when we had two spellings, but after your mass conversion, the .cocci script is unlikely to ever find regressions on this front.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]