tony2001 Thu Jan 25 14:38:45 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/date/lib parse_tz.c
Log:
add missing ifdefs
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.20.2.6.2.11&r2=1.20.2.6.2.12&diff_format=u
Index: php-src/ext/date/lib/parse_tz.c
diff -u php-src/ext/date/lib/parse_tz.c:1.20.2.6.2.11
php-src/ext/date/lib/parse_tz.c:1.20.2.6.2.12
--- php-src/ext/date/lib/parse_tz.c:1.20.2.6.2.11 Thu Jan 25 13:37:04 2007
+++ php-src/ext/date/lib/parse_tz.c Thu Jan 25 14:38:45 2007
@@ -16,12 +16,15 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_tz.c,v 1.20.2.6.2.11 2007/01/25 13:37:04 tony2001 Exp $ */
+/* $Id: parse_tz.c,v 1.20.2.6.2.12 2007/01/25 14:38:45 tony2001 Exp $ */
#include "timelib.h"
#include <stdio.h>
+
+#ifdef HAVE_LOCALE_H
#include <locale.h>
+#endif
#ifdef HAVE_STRING_H
#include <string.h>
@@ -196,13 +199,15 @@
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;
-
+
tmp = setlocale(LC_CTYPE, NULL);
if (tmp) {
cur_locale = strdup(tmp);
}
setlocale(LC_CTYPE, "C");
+#endif
do {
int mid = ((unsigned)left + right) >> 1;
@@ -214,15 +219,19 @@
left = mid + 1;
} else { /* (cmp == 0) */
(*tzf) = &(tzdb->data[tzdb->index[mid].pos + 20]);
+#ifdef HAVE_SETLOCALE
setlocale(LC_CTYPE, cur_locale);
if (cur_locale) free(cur_locale);
+#endif
return 1;
}
} while (left <= right);
+#ifdef HAVE_SETLOCALE
setlocale(LC_CTYPE, cur_locale);
if (cur_locale) free(cur_locale);
+#endif
return 0;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php