[master] 5e5b442f5 VSLb() is not the choice for a single string argument

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Jul 20 15:58:07 UTC 2022


--------
Nils Goroll writes:

> On 20.07.22 17:31, Dridi Boukelmoune wrote:
> > Wouldn't this also work?
> > 
> >     VSLb(ctx->vsl, SLT_VCL_Error, "%s", err);
>
> Yes it should. But why not avoid an snprintf if we can?

+0

At least on FreeBSD it is surprisingly cheap.  In the normal
case, for instance printf("%s", ...) it is free, because the
compiler turns it into a fputs() instead.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the varnish-commit mailing list