summaryrefslogtreecommitdiff
path: root/ext/date/lib/parse_tz.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/date/lib/parse_tz.c')
-rw-r--r--ext/date/lib/parse_tz.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
index 3b68549c32..960e5288f0 100644
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
@@ -377,25 +377,14 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
{
int left = 0, right = tzdb->index_size - 1;
-#ifdef HAVE_SETLOCALE
- char *cur_locale = NULL, *tmp;
-#endif
if (tzdb->index_size == 0) {
return 0;
}
-#ifdef HAVE_SETLOCALE
- tmp = setlocale(LC_CTYPE, NULL);
- if (tmp) {
- cur_locale = timelib_strdup(tmp);
- }
- setlocale(LC_CTYPE, "C");
-#endif
-
do {
int mid = ((unsigned)left + right) >> 1;
- int cmp = strcasecmp(timezone, tzdb->index[mid].id);
+ int cmp = timelib_strcasecmp(timezone, tzdb->index[mid].id);
if (cmp < 0) {
right = mid - 1;
@@ -403,19 +392,11 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
left = mid + 1;
} else { /* (cmp == 0) */
(*tzf) = &(tzdb->data[tzdb->index[mid].pos]);
-#ifdef HAVE_SETLOCALE
- setlocale(LC_CTYPE, cur_locale);
- if (cur_locale) timelib_free(cur_locale);
-#endif
return 1;
}
} while (left <= right);
-#ifdef HAVE_SETLOCALE
- setlocale(LC_CTYPE, cur_locale);
- if (cur_locale) timelib_free(cur_locale);
-#endif
return 0;
}
@@ -424,7 +405,7 @@ const timelib_tzdb *timelib_builtin_db(void)
return &timezonedb_builtin;
}
-const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(timelib_tzdb *tzdb, int *count)
+const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_tzdb *tzdb, int *count)
{
*count = tzdb->index_size;
return tzdb->index;