]> granicus.if.org Git - php/commitdiff
add missing ifdefs
authorAntony Dovgal <tony2001@php.net>
Thu, 25 Jan 2007 14:38:45 +0000 (14:38 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 25 Jan 2007 14:38:45 +0000 (14:38 +0000)
ext/date/lib/parse_tz.c

index 24839613652ccd2bdacbe5337259ea5d07036687..1d2ff86e3f6e9b1dec8f5b00968f7b6ac17bb2e2 100644 (file)
 #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 @@ 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;
-       
+
        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 @@ 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 + 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;
 }