* [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups
@ 2017-06-24 18:10 Eric Blake
2017-06-24 18:10 ` [Qemu-devel] [PATCH v2 1/2] qobject: Catch another straggler for use of qdict_put_str() Eric Blake
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Eric Blake @ 2017-06-24 18:10 UTC (permalink / raw)
To: qemu-devel; +Cc: armbru, marcandre.lureau, stefanha
v1 was here:
https://lists.gnu.org/archive/html/qemu-devel/2017-06/msg02589.html
Since then:
- reorder the series
- add R-b on patch 1
- patch 2 updated to catch recent introduction of longhand usage
Eric Blake (2):
qobject: Catch another straggler for use of qdict_put_str()
qobject: Update coccinelle script to catch Q{INC,DEC}REF
monitor.c | 2 +-
qemu-img.c | 2 +-
scripts/coccinelle/qobject.cocci | 6 ++++++
3 files changed, 8 insertions(+), 2 deletions(-)
--
2.9.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH v2 1/2] qobject: Catch another straggler for use of qdict_put_str()
2017-06-24 18:10 [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups Eric Blake
@ 2017-06-24 18:10 ` Eric Blake
2017-06-24 18:10 ` [Qemu-devel] [PATCH v2 2/2] qobject: Update coccinelle script to catch Q{INC, DEC}REF Eric Blake
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2017-06-24 18:10 UTC (permalink / raw)
To: qemu-devel
Cc: armbru, marcandre.lureau, stefanha, Kevin Wolf, Max Reitz,
open list:Block layer core
Dan's addition of key-secret improvements in commit 29cf9336 was
developed prior to the addition of QDict scalar insertion macros,
but merged after the general cleanup in commit 46f5ac20.
Patch created mechanically by rerunning:
spatch --sp-file scripts/coccinelle/qobject.cocci \
--macro-file scripts/cocci-macro-file.h --dir . --in-place
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
---
v2: reorder series
---
qemu-img.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qemu-img.c b/qemu-img.c
index 0ad698d..6c972f7 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -355,7 +355,7 @@ static int img_add_key_secrets(void *opaque,
QDict *options = opaque;
if (g_str_has_suffix(name, "key-secret")) {
- qdict_put(options, name, qstring_from_str(value));
+ qdict_put_str(options, name, value);
}
return 0;
--
2.9.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] qobject: Update coccinelle script to catch Q{INC, DEC}REF
2017-06-24 18:10 [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups Eric Blake
2017-06-24 18:10 ` [Qemu-devel] [PATCH v2 1/2] qobject: Catch another straggler for use of qdict_put_str() Eric Blake
@ 2017-06-24 18:10 ` Eric Blake
2017-06-26 9:51 ` [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups Markus Armbruster
2017-06-26 15:56 ` Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2017-06-24 18:10 UTC (permalink / raw)
To: qemu-devel; +Cc: armbru, marcandre.lureau, stefanha, Dr. David Alan Gilbert
The recent commit b097efc0 used qobject_decref(QOBJECT(E)), even
though we already have QDECREF(E) for that purpose. We can update
our coccinelle script to catch any future relapses; with that in
place, the rest of the patch is generated with:
spatch --sp-file scripts/coccinelle/qobject.cocci \
--macro-file scripts/cocci-macro-file.h --dir . --in-place
Signed-off-by: Eric Blake <eblake@redhat.com>
---
v2: fix a misuse that crept in since v1
---
monitor.c | 2 +-
scripts/coccinelle/qobject.cocci | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/monitor.c b/monitor.c
index 3c369f4..b0fde7f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3829,7 +3829,7 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
req_json = qobject_to_json(req);
trace_handle_qmp_command(mon, qstring_get_str(req_json));
- qobject_decref(QOBJECT(req_json));
+ QDECREF(req_json);
rsp = qmp_dispatch(cur_mon->qmp.commands, req);
diff --git a/scripts/coccinelle/qobject.cocci b/scripts/coccinelle/qobject.cocci
index c3253de..c518caf 100644
--- a/scripts/coccinelle/qobject.cocci
+++ b/scripts/coccinelle/qobject.cocci
@@ -3,6 +3,12 @@
expression Obj, Key, E;
@@
(
+- qobject_incref(QOBJECT(E));
++ QINCREF(E);
+|
+- qobject_decref(QOBJECT(E));
++ QDECREF(E);
+|
- qdict_put_obj(Obj, Key, QOBJECT(E));
+ qdict_put(Obj, Key, E);
|
--
2.9.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups
2017-06-24 18:10 [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups Eric Blake
2017-06-24 18:10 ` [Qemu-devel] [PATCH v2 1/2] qobject: Catch another straggler for use of qdict_put_str() Eric Blake
2017-06-24 18:10 ` [Qemu-devel] [PATCH v2 2/2] qobject: Update coccinelle script to catch Q{INC, DEC}REF Eric Blake
@ 2017-06-26 9:51 ` Markus Armbruster
2017-06-26 15:56 ` Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2017-06-26 9:51 UTC (permalink / raw)
To: Eric Blake; +Cc: qemu-devel, marcandre.lureau, stefanha
Eric Blake <eblake@redhat.com> writes:
> v1 was here:
> https://lists.gnu.org/archive/html/qemu-devel/2017-06/msg02589.html
>
> Since then:
> - reorder the series
> - add R-b on patch 1
You missed Max's. Adding it in my tree.
> - patch 2 updated to catch recent introduction of longhand usage
Applied to qapi-next. Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups
2017-06-24 18:10 [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups Eric Blake
` (2 preceding siblings ...)
2017-06-26 9:51 ` [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups Markus Armbruster
@ 2017-06-26 15:56 ` Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-06-26 15:56 UTC (permalink / raw)
To: Eric Blake; +Cc: qemu-devel, armbru, marcandre.lureau
[-- Attachment #1: Type: text/plain, Size: 704 bytes --]
On Sat, Jun 24, 2017 at 12:10:06PM -0600, Eric Blake wrote:
> v1 was here:
> https://lists.gnu.org/archive/html/qemu-devel/2017-06/msg02589.html
>
> Since then:
> - reorder the series
> - add R-b on patch 1
> - patch 2 updated to catch recent introduction of longhand usage
>
> Eric Blake (2):
> qobject: Catch another straggler for use of qdict_put_str()
> qobject: Update coccinelle script to catch Q{INC,DEC}REF
>
> monitor.c | 2 +-
> qemu-img.c | 2 +-
> scripts/coccinelle/qobject.cocci | 6 ++++++
> 3 files changed, 8 insertions(+), 2 deletions(-)
>
> --
> 2.9.4
>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-26 15:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-24 18:10 [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups Eric Blake
2017-06-24 18:10 ` [Qemu-devel] [PATCH v2 1/2] qobject: Catch another straggler for use of qdict_put_str() Eric Blake
2017-06-24 18:10 ` [Qemu-devel] [PATCH v2 2/2] qobject: Update coccinelle script to catch Q{INC, DEC}REF Eric Blake
2017-06-26 9:51 ` [Qemu-devel] [PATCH v2 0/2] qobject coccinelle followups Markus Armbruster
2017-06-26 15:56 ` Stefan Hajnoczi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.