Re: Coccinelle: semantic patch for missing of_node_put

From: Markus Elfring
Date: Tue Jun 04 2019 - 07:34:02 EST


> let add_function f c =
> if not (List.mem f !relevant_functions)
> then
> begin
> let s = String.concat " "
> (
> (List.map String.lowercase_ascii
> (List.filter
> (function x ->
> Str.string_match
> (Str.regexp "[a-zA-Z_\\(\\)][-a-zA-Z0-9_\\(\\)]*$")
> x 0) (Str.split (Str.regexp "[ .;\t\n]+") c)))) in

I would interpret one of these function calls in the way
that text splitting is performed here also for space characters
after a concatenation was performed.


> Printf.printf "comments: %s\n" s;
> if contains s relevant_str
> then
> Printf.printf "Found relevant function: %s\n" f;
> relevant_functions := f :: !relevant_functions;
> end
>
> @r@
> identifier fn;
> comments c;
> type T = struct device_node *;
> @@
>
> T@c fn(...) {
> ...
> }
>
> @script:ocaml@
> f << r.fn;
> c << r.c;
> @@
>
> let (cb,cm,ca) = List.hd c in
> let c = String.concat " " cb in
> add_function f c

Can an other data processing variant be more reasonable?

Regards,
Markus