[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 3/5] qobject: replace qobject_incref/QINCREF
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v6 3/5] qobject: replace qobject_incref/QINCREF qobject_decref/QDECREF |
Date: |
Fri, 27 Apr 2018 10:59:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 04/19/2018 10:01 AM, Marc-André Lureau wrote:
>> Now that we can safely call QOBJECT() on QObject * as well as its
>> subtypes, we can have macros qobject_ref() / qobject_unref() that work
>> everywhere instead of having to use QINCREF() / QDECREF() for QObject
>> and qobject_incref() / qobject_decref() for its subtypes.
>>
>> Note that the new macros evaluate their argument exactly once, thus no
>> need to shout them.
>
> It's still useful information to include in the commit message that you
> did the substitution by sed, then fixed up compiler warnings that
> resulted from the new macro implementation being slightly more
> type-safe, as well as fixing up a long line. That way, if someone
> backports this patch, they know how to resolve conflicts and/or check
> that they are not missing a conversion.
What about inserting
The replacement is mechanical, except I broke a long line, and added
a cast in monitor_qmp_cleanup_req_queue_locked(). Unlike
qobject_decref(), qobject_unref() doesn't accept void *.
The justification sounds awkward because it is. qobject_unref() turns
out to be less function-like than it looks on first glance. The actual
culprit is QOBJECT().
> Writing good commit messages is an art form - but in general, if
> something was questioned during review of a previous revision, then it's
> never a bad idea to beef up the commit message to answer that question
> in advance for the next reviewer.
>
>> Signed-off-by: Marc-André Lureau <address@hidden>
>> Reviewed-by: Eric Blake <address@hidden>
- [Qemu-devel] [PATCH v6 2/5] qobject: use a QObjectBase_ struct, (continued)
- [Qemu-devel] [PATCH v6 2/5] qobject: use a QObjectBase_ struct, Marc-André Lureau, 2018/04/19
- [Qemu-devel] [PATCH v6 5/5] qobject: modify qobject_ref() to assert on NULL, Marc-André Lureau, 2018/04/19
- [Qemu-devel] [PATCH v6 4/5] qobject: modify qobject_ref() to return obj, Marc-André Lureau, 2018/04/19
- [Qemu-devel] [PATCH v6 3/5] qobject: replace qobject_incref/QINCREF qobject_decref/QDECREF, Marc-André Lureau, 2018/04/19
- Re: [Qemu-devel] [PATCH v6 0/5] Simplify qobject refcount, Eric Blake, 2018/04/19