• M
    Use error_fatal to simplify obvious fatal errors · 007b0657
    Markus Armbruster 提交于
    Done with this Coccinelle semantic patch:
    
        @@
        type T;
        identifier FUN, RET;
        expression list ARGS;
        expression ERR, EC;
        @@
        (
        -    T RET = FUN(ARGS, &ERR);
        +    T RET = FUN(ARGS, &error_fatal);
        |
        -    RET = FUN(ARGS, &ERR);
        +    RET = FUN(ARGS, &error_fatal);
        |
        -    FUN(ARGS, &ERR);
        +    FUN(ARGS, &error_fatal);
        )
        -    if (ERR != NULL) {
        -        error_report_err(ERR);
        -        exit(EC);
        -    }
    
    This is actually a more elegant version of my initial semantic patch
    by courtesy of Eduardo.
    
    It leaves dead Error * variables behind, cleaned up manually.
    
    Cc: qemu-arm@nongnu.org
    Cc: "Michael S. Tsirkin" <mst@redhat.com>
    Cc: Eduardo Habkost <ehabkost@redhat.com>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
    007b0657
highbank.c 15.0 KB