qemu/scripts/coccinelle/qobject.cocci
<<
>>
Prefs
   1// Use QDict macros where they make sense
   2@@
   3expression Obj, Key, E;
   4@@
   5(
   6- qobject_ref(QOBJECT(E));
   7+ qobject_ref(E);
   8|
   9- qobject_unref(QOBJECT(E));
  10+ qobject_unref(E);
  11|
  12- qdict_put_obj(Obj, Key, QOBJECT(E));
  13+ qdict_put(Obj, Key, E);
  14|
  15- qdict_put(Obj, Key, qnum_from_int(E));
  16+ qdict_put_int(Obj, Key, E);
  17|
  18- qdict_put(Obj, Key, qbool_from_bool(E));
  19+ qdict_put_bool(Obj, Key, E);
  20|
  21- qdict_put(Obj, Key, qstring_from_str(E));
  22+ qdict_put_str(Obj, Key, E);
  23|
  24- qdict_put(Obj, Key, qnull());
  25+ qdict_put_null(Obj, Key);
  26)
  27
  28// Use QList macros where they make sense
  29@@
  30expression Obj, E;
  31@@
  32(
  33- qlist_append_obj(Obj, QOBJECT(E));
  34+ qlist_append(Obj, E);
  35|
  36- qlist_append(Obj, qnum_from_int(E));
  37+ qlist_append_int(Obj, E);
  38|
  39- qlist_append(Obj, qbool_from_bool(E));
  40+ qlist_append_bool(Obj, E);
  41|
  42- qlist_append(Obj, qstring_from_str(E));
  43+ qlist_append_str(Obj, E);
  44|
  45- qlist_append(Obj, qnull());
  46+ qlist_append_null(Obj);
  47)
  48