gpsd-dev
[Top][All Lists]
Advanced

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

Re: [gpsd-dev] [PATCH] Add Windows versions of time related functions.


From: Gary E. Miller
Subject: Re: [gpsd-dev] [PATCH] Add Windows versions of time related functions.
Date: Wed, 23 Mar 2016 17:50:25 -0700

Yo Oliver!

On Thu, 24 Mar 2016 00:37:11 +0000
Oliver Jowett <address@hidden> wrote:

> On 24 March 2016 at 00:28, Gary E. Miller <address@hidden> wrote:
> 
> > Yeah, sort of.  Having code serving no purpose is an accident
> > waiting to happen.  No need for the strdup(), no need even for a
> > strcpy(), just operating on the passed in string is faster,
> > simpler, clearer and thus less likely to hide bugs.
> >  
> 
> strtok_r modifies its input.

Hmm, I don't see that on the man page, but that makes sense because the
string input is not marked const.

Then the strdup() can be replaced by a srtlcpy() into a char[XXX] on the
local stack.  That saves 2 if()s and free().

I think XXX is about 22?

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

Attachment: pgpMIEChd2yBR.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]