Re: [Cocci] [PATCH 01/18] coccinelle: change strncpy+truncation to strlcpy

From: Himanshu Jha
Date: Fri Jul 13 2018 - 06:21:17 EST


> Thanks Himanshu for the suggestions.
>
> However, I'm not sure to follow the discussion. The original problem was
> that Coccinelle was removing a comment that should be preserved. I think
> that this occurs because the line just below the comment is completely
> removed. Coccinelle considers that the comment belongs with that line and
> if the line is removed the comment won't make much sense.
>
> In Himanshu's solution, the code is just not transformed at all, so as a
> side effect the comment stays too. Is that what is wanted in this case?

Yes, there is no transformation with my solution which I advised to
prevent comment removal(which i thought was useful).

My rule is more narrower approach than the regular ones which used
"expression" metavariable.

Rest upto Dominique to choose whatever suits better :)

--
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology