SF Markus Elfring wrote on Fri, Jul 13, 2018:
> > +msg = "SUGGESTION: strncpy followed by truncation can be strlcpy"
> > +coccilib.report.print_report(p[0],msg)
> 
> I would prefer to omit an intermediate Python variable (similar to the 
> previous
> SmPL rule) just for the simple display of such a message.
> 
> +coccilib.report.print_report(p[0],
> +                             "SUGGESTION: strncpy followed by truncation can 
> be strlcpy.")

Out of curiosity, is the performance cost of using an intermediate
variable high in spatch?
I personally do not mind either way, but that does make for a pretty
long line once indented and I know many who would prefer the initial
version.

> > +-strncpy at p(
> > ++strlcpy(
> > +  dest, src, sz);
> 
> How do you think about to adjust another SmPL code transformation 
> specification
> like the following?
> 
> +-strncpy@p
> ++strlcpy
> +        (dest, src, sz);

This also came from the example I picked, but if this does not make a
difference as it sounds like I will update to that.

-- 
Dominique Martinet
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to