aboutsummaryrefslogtreecommitdiff
path: root/time/strptime.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-08-29 08:51:26 +0000
committerUlrich Drepper <drepper@redhat.com>2002-08-29 08:51:26 +0000
commit160d067b046c2ee3296853129d1ea9a99156e2b8 (patch)
tree77134f8afec02ad11c0582ac323ef25c0bf04975 /time/strptime.c
parent01beb5b9ff8fb38f6517837b42eea8f5ff7060d9 (diff)
downloadglibc-160d067b046c2ee3296853129d1ea9a99156e2b8.zip
glibc-160d067b046c2ee3296853129d1ea9a99156e2b8.tar.gz
glibc-160d067b046c2ee3296853129d1ea9a99156e2b8.tar.bz2
(gaih_inet): Fix code to determine canonical name.
Diffstat (limited to 'time/strptime.c')
-rw-r--r--time/strptime.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/time/strptime.c b/time/strptime.c
index 5d8fe90..7208dde 100644
--- a/time/strptime.c
+++ b/time/strptime.c
@@ -71,11 +71,19 @@ localtime_r (t, tp)
#define match_char(ch1, ch2) if (ch1 != ch2) return NULL
#if defined __GNUC__ && __GNUC__ >= 2
-# define match_string(cs1, s2) \
+# ifdef USE_IN_EXTENDED_LOCALE_MODEL
+# define match_string(cs1, s2) \
+ ({ size_t len = strlen (cs1); \
+ int result = __strncasecmp_l ((cs1), (s2), len, locale) == 0; \
+ if (result) (s2) += len; \
+ result; })
+# else
+# define match_string(cs1, s2) \
({ size_t len = strlen (cs1); \
int result = strncasecmp ((cs1), (s2), len) == 0; \
if (result) (s2) += len; \
result; })
+# endif
#else
/* Oh come on. Get a reasonable compiler. */
# define match_string(cs1, s2) \
@@ -203,6 +211,7 @@ const unsigned short int __mon_yday[2][13] =
# define LOCALE_PARAM_PROTO , __locale_t locale
# define LOCALE_PARAM_DECL __locale_t locale;
# define HELPER_LOCALE_ARG , current
+# define ISSPACE(Ch) __isspace_l (Ch, locale)
#else
# define LOCALE_PARAM
# define LOCALE_ARG
@@ -213,6 +222,7 @@ const unsigned short int __mon_yday[2][13] =
# else
# define HELPER_LOCALE_ARG
# endif
+# define ISSPACE(Ch) isspace (Ch)
#endif
@@ -306,9 +316,9 @@ strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
{
/* A white space in the format string matches 0 more or white
space in the input string. */
- if (isspace (*fmt))
+ if (ISSPACE (*fmt))
{
- while (isspace (*rp))
+ while (ISSPACE (*rp))
++rp;
++fmt;
continue;
@@ -529,7 +539,7 @@ strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
case 'n':
case 't':
/* Match any white space. */
- while (isspace (*rp))
+ while (ISSPACE (*rp))
++rp;
break;
case 'p':