qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

remove_local_err.cocci (541B)


      1 // Replace unnecessary usage of local_err variable with
      2 // direct usage of errp argument
      3 
      4 @@
      5 identifier F;
      6 expression list ARGS;
      7 expression F2;
      8 identifier LOCAL_ERR;
      9 identifier ERRP;
     10 idexpression V;
     11 typedef Error;
     12 @@
     13  F(..., Error **ERRP)
     14  {
     15      ...
     16 -    Error *LOCAL_ERR;
     17      ... when != LOCAL_ERR
     18          when != ERRP
     19 (
     20 -    F2(ARGS, &LOCAL_ERR);
     21 -    error_propagate(ERRP, LOCAL_ERR);
     22 +    F2(ARGS, ERRP);
     23 |
     24 -    V = F2(ARGS, &LOCAL_ERR);
     25 -    error_propagate(ERRP, LOCAL_ERR);
     26 +    V = F2(ARGS, ERRP);
     27 )
     28      ... when != LOCAL_ERR
     29  }