• Dridi Boukelmoune's avatar
    Kill redundant redundant null checks · 2ce13cf2
    Dridi Boukelmoune authored
    I caught one during a review and figured I might as well sweep the whole
    tree, so this patch was created using Coccinelle and the following steps:
    
        $ cat >check_obj.cocci <<EOF
        @@
        expression obj, magic;
        @@
    
        if (obj != NULL) {
        - CHECK_OBJ_NOTNULL(obj, magic);
        + CHECK_OBJ(obj, magic);
        ...
        }
        EOF
        $ spatch --dir . --in-place --sp-file check_obj.cocci
    
    This is my fourth semantic patch, I wouldn't mind checking them in to
    have them handy in the repo to semi-automate code polish every now and
    then. For example in a /tools/cocci directory. This way people could
    study them or use them in their out-of-tree projects like VMODs or VUTs.
    2ce13cf2
vxp_parse.c 13.3 KB