[PATCH ocserv 2/3] Use helper functions to send common HTTP headers/responses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2016-01-25 at 08:04 -0800, Kevin Cernekee wrote:
> On Mon, Jan 25, 2016 at 12:53 AM, Nikos Mavrogiannopoulos
> <nmav at gnutls.org> wrote:
> > On Sun, Jan 24, 2016 at 10:11 PM, Kevin Cernekee <
> > cernekee at gmail.com> wrote:
> > > Factor out duplicated code in the AnyConnect compatibility 
> > > handlers.
> > 
> > Hi Kevin,
> >  On this particular patch send_string() uses strlen(), instead of
> > relying on the compile-time sizeof(). Is there any need for that?
> > Since the strings are fixed, I don't see an advantage from using
> > strlen().
> 
> It seemed less error-prone than relying on the caller to pass the
> length, especially if non-constant strings are used in the future.
> We're never passing strings containing '\0', and the overhead of
> calling strlen() once for each HTTP request is negligible.
> But I can change it if you prefer sizeof.

Even though negligible it is repeated on every connection for no
particular reason. I'd prefer to have sizeof() for static strings and
we can always extend later when we have other string types.

regards,
Nikos




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux