[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
strptime.c: ANSI C compatibility
From: |
Bruno Haible |
Subject: |
strptime.c: ANSI C compatibility |
Date: |
Fri, 23 Mar 2007 03:04:42 +0100 |
User-agent: |
KMail/1.5.4 |
lib/strptime.c is borrowed from glibc and uses C99 syntax. This leads to
a compilation error on BeOS, which uses a gcc version < 2.95.
Here is a proposed fix. OK, Paul?
2007-03-22 Bruno Haible <address@hidden>
* lib/strptime.c (__strptime_internal): Use ANSI C syntax.
*** lib/strptime.c 12 Feb 2007 18:49:19 -0000 1.3
--- lib/strptime.c 23 Mar 2007 01:58:26 -0000
***************
*** 668,680 ****
specify hours. If fours digits are used, minutes are
also specified. */
{
val = 0;
while (*rp == ' ')
++rp;
if (*rp != '+' && *rp != '-')
return NULL;
! bool neg = *rp++ == '-';
! int n = 0;
while (n < 4 && *rp >= '0' && *rp <= '9')
{
val = val * 10 + *rp++ - '0';
--- 668,683 ----
specify hours. If fours digits are used, minutes are
also specified. */
{
+ bool neg;
+ int n;
+
val = 0;
while (*rp == ' ')
++rp;
if (*rp != '+' && *rp != '-')
return NULL;
! neg = *rp++ == '-';
! n = 0;
while (n < 4 && *rp >= '0' && *rp <= '9')
{
val = val * 10 + *rp++ - '0';
- strptime.c: ANSI C compatibility,
Bruno Haible <=