On Fri, 13 Jul 2018, Dominique Martinet wrote:

> 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?

There is no reason that it would have any cost.

> 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.

Probably not removing something just to add it back would be a good idea.

julia

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

Reply via email to