[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] svn-fast-time-from-cstring.patch

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-12-11 16:45:24 CET

Brandon Ehle <azverkan@yahoo.com> writes:

> + /* Open-code parsing of the new timestamp format, as this
> + is a hot path for reading the entries file.
> + + This format looks like:
>
> + "2001-08-31T04:24:14.966996Z" */
> + exploded_time.tm_year = strtoul(c, (char**)&c, 10);
> + if (*c++ != '-') goto fail;

If I look at /usr/local/apache2/include/httpd.h it says

  /** strtoul does not exist on sunos4. */
  #ifdef strtoul
  #undef strtoul
  #endif
  #define strtoul strtoul_is_not_a_portable_function_use_strtol_instead

Perhaps we should use strtol into a temporary, and check for -ve
values.

> + exploded_time.tm_mon = strtoul(c, (char**)&c, 10);
> + if (*c++ != '-') goto fail;
> + exploded_time.tm_mday = strtoul(c, (char**)&c, 10);
> + if (*c++ != 'T') goto fail;
> + exploded_time.tm_hour = strtoul(c, (char**)&c, 10);
> + if (*c++ != ':') goto fail;
> + exploded_time.tm_min = strtoul(c, (char**)&c, 10);
> + if (*c++ != ':') goto fail;
> + exploded_time.tm_sec = strtoul(c, (char**)&c, 10);
> + if (*c++ != '.') goto fail;
> + exploded_time.tm_usec = strtoul(c, (char**)&c, 10);
> + if (*c++ != 'Z') goto fail;
> +

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Dec 11 16:46:08 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.