mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
error: Remove unnecessary local_err variables
This patch simplifies code that uses a local_err variable just to immediately use it for an error_propagate() call. Coccinelle patch used to perform the changes added to scripts/coccinelle/remove_local_err.cocci. Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1465855078-19435-3-git-send-email-ehabkost@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Blank line in s390-virtio-ccw.c restored] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
621ff94d50
commit
6b62d96137
6 changed files with 41 additions and 36 deletions
29
scripts/coccinelle/remove_local_err.cocci
Normal file
29
scripts/coccinelle/remove_local_err.cocci
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Replace unnecessary usage of local_err variable with
|
||||
// direct usage of errp argument
|
||||
|
||||
@@
|
||||
identifier F;
|
||||
expression list ARGS;
|
||||
expression F2;
|
||||
identifier LOCAL_ERR;
|
||||
identifier ERRP;
|
||||
idexpression V;
|
||||
typedef Error;
|
||||
@@
|
||||
F(..., Error **ERRP)
|
||||
{
|
||||
...
|
||||
- Error *LOCAL_ERR;
|
||||
... when != LOCAL_ERR
|
||||
when != ERRP
|
||||
(
|
||||
- F2(ARGS, &LOCAL_ERR);
|
||||
- error_propagate(ERRP, LOCAL_ERR);
|
||||
+ F2(ARGS, ERRP);
|
||||
|
|
||||
- V = F2(ARGS, &LOCAL_ERR);
|
||||
- error_propagate(ERRP, LOCAL_ERR);
|
||||
+ V = F2(ARGS, ERRP);
|
||||
)
|
||||
... when != LOCAL_ERR
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue