Hello,

another question (might be obvious, but I tried a number of things without
success). Given this spatch:

===

@ init @
identifier struct_name, bin;
@@

        struct struct_name {
                ...
                struct bin_attribute bin;
                ...
        };

@ main extends init @
expression E;
statement S;
identifier name, err;
@@

        struct struct_name *name;
        ...
(
        sysfs_bin_attr_init(&name->bin);
|
+       sysfs_bin_attr_init(&name->bin);
        if (sysfs_create_bin_file(E, &name->bin))
                S
|
+       sysfs_bin_attr_init(&name->bin);
        err = sysfs_create_bin_file(E, &name->bin);
)

===

This works well in general. Only problem is that

        struct struct_name *name;
        ...

is too narrow. Places also needing a fix may look like

        struct struct_name *name = something;

or even

        function(..., struct struct_name *name)
        {
        }

So, I want to match something like

        ... struct struct_name *name ...

meaning it can be anywhere, e.g. in a function argument or in a declaration,
etc. Is this possible or do I think too much of grep (=text-matching) here?

Thanks again,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to