]> git.pld-linux.org Git - packages/php.git/blame - php-systzdata.patch
- unified bzip2 bcond name
[packages/php.git] / php-systzdata.patch
CommitLineData
cacce04b
ER
1# License: MIT
2# http://opensource.org/licenses/MIT
3
c0240cb1 4Add support for use of the system timezone database, rather
5than embedding a copy. Discussed upstream but was not desired.
6
7History:
5cd8d883 8r18: adapt for autotool change in 7.3.3RC1
539ed3cb
AG
9r17: adapt for timelib 2018.01 (in 7.3.2RC1)
10r16: adapt for timelib 2017.06 (in 7.2.3RC1)
cacce04b
ER
11r15: adapt for timelib 2017.05beta7 (in 7.2.0RC1)
12r14: improve check for valid tz file
909e9211 13r13: adapt for upstream changes to use PHP allocator
a659fa18
ER
14r12: adapt for upstream changes for new zic
15r11: use canonical names to avoid more case sensitivity issues
16 round lat/long from zone.tab towards zero per builtin db
17r10: make timezone case insensitive
361fb152
ER
18r9: fix another compile error without --with-system-tzdata configured (Michael Heimpold)
19r8: fix compile error without --with-system-tzdata configured
c0240cb1 20r7: improve check for valid timezone id to exclude directories
a659fa18 21r6: fix fd leak in r5, fix country code/BC flag use in
c0240cb1 22 timezone_identifiers_list() using system db,
23 fix use of PECL timezonedb to override system db,
24r5: reverts addition of "System/Localtime" fake tzname.
25 updated for 5.3.0, parses zone.tab to pick up mapping between
26 timezone name, country code and long/lat coords
27r4: added "System/Localtime" tzname which uses /etc/localtime
28r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert)
29r2: add filesystem trawl to set up name alias index
30r1: initial revision
31
5cd8d883
AG
32diff -up php-7.3.3RC1/ext/date/config0.m4.systzdata php-7.3.3RC1/ext/date/config0.m4
33--- php-7.3.3RC1/ext/date/config0.m4.systzdata 2019-02-19 14:57:51.314601701 +0100
34+++ php-7.3.3RC1/ext/date/config0.m4 2019-02-19 14:58:29.050812587 +0100
35@@ -9,6 +9,19 @@ io.h
36 dnl Check for strtoll, atoll
37 AC_CHECK_FUNCS(strtoll atoll)
38
39+PHP_ARG_WITH(system-tzdata, for use of system timezone data,
40+[ --with-system-tzdata[=DIR] to specify use of system timezone data],
41+no, no)
42+
43+if test "$PHP_SYSTEM_TZDATA" != "no"; then
44+ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used])
45+
46+ if test "$PHP_SYSTEM_TZDATA" != "yes"; then
47+ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA",
48+ [Define for location of system timezone data])
49+ fi
50+fi
51+
52 PHP_DATE_CFLAGS="-I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1"
53 timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c
54 lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c"
55diff -up php-7.3.3RC1/ext/date/lib/parse_tz.c.systzdata php-7.3.3RC1/ext/date/lib/parse_tz.c
56--- php-7.3.3RC1/ext/date/lib/parse_tz.c.systzdata 2019-02-19 12:18:27.000000000 +0100
57+++ php-7.3.3RC1/ext/date/lib/parse_tz.c 2019-02-19 14:57:20.397428931 +0100
cacce04b 58@@ -25,8 +25,21 @@
c0240cb1 59 #include "timelib.h"
cacce04b 60 #include "timelib_private.h"
c0240cb1 61
62+#ifdef HAVE_SYSTEM_TZDATA
63+#include <sys/mman.h>
64+#include <sys/stat.h>
65+#include <limits.h>
66+#include <fcntl.h>
67+#include <unistd.h>
68+
69+#include "php_scandir.h"
c0240cb1 70+
cacce04b 71+#else
909e9211 72 #define TIMELIB_SUPPORTS_V2DATA
c0240cb1 73 #include "timezonedb.h"
74+#endif
75+
76+#include <ctype.h>
77
78 #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
79 # if defined(__LITTLE_ENDIAN__)
539ed3cb 80@@ -87,6 +100,11 @@ static int read_php_preamble(const unsig
c0240cb1 81 {
a659fa18
ER
82 uint32_t version;
83
84+ if (memcmp(*tzf, "TZif", 4) == 0) {
85+ *tzf += 20;
86+ return 0;
87+ }
909e9211 88+
a659fa18
ER
89 /* read ID */
90 version = (*tzf)[3] - '0';
91 *tzf += 4;
539ed3cb 92@@ -411,7 +429,429 @@ void timelib_dump_tzinfo(timelib_tzinfo
c0240cb1 93 }
94 }
95
96-static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
97+#ifdef HAVE_SYSTEM_TZDATA
98+
99+#ifdef HAVE_SYSTEM_TZDATA_PREFIX
100+#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX
101+#else
102+#define ZONEINFO_PREFIX "/usr/share/zoneinfo"
103+#endif
104+
105+/* System timezone database pointer. */
7588b36c 106+static const timelib_tzdb *timezonedb_system;
c0240cb1 107+
108+/* Hash table entry for the cache of the zone.tab mapping table. */
109+struct location_info {
110+ char code[2];
111+ double latitude, longitude;
112+ char name[64];
113+ char *comment;
114+ struct location_info *next;
115+};
116+
117+/* Cache of zone.tab. */
118+static struct location_info **system_location_table;
119+
120+/* Size of the zone.tab hash table; a random-ish prime big enough to
121+ * prevent too many collisions. */
122+#define LOCINFO_HASH_SIZE (1021)
123+
7588b36c 124+/* Compute a case insensitive hash of str */
c0240cb1 125+static uint32_t tz_hash(const char *str)
126+{
127+ const unsigned char *p = (const unsigned char *)str;
128+ uint32_t hash = 5381;
129+ int c;
909e9211 130+
7588b36c 131+ while ((c = tolower(*p++)) != '\0') {
c0240cb1 132+ hash = (hash << 5) ^ hash ^ c;
133+ }
909e9211 134+
c0240cb1 135+ return hash % LOCINFO_HASH_SIZE;
136+}
137+
138+/* Parse an ISO-6709 date as used in zone.tab. Returns end of the
139+ * parsed string on success, or NULL on parse error. On success,
140+ * writes the parsed number to *result. */
141+static char *parse_iso6709(char *p, double *result)
142+{
143+ double v, sign;
144+ char *pend;
145+ size_t len;
146+
147+ if (*p == '+')
148+ sign = 1.0;
149+ else if (*p == '-')
150+ sign = -1.0;
151+ else
152+ return NULL;
153+
154+ p++;
155+ for (pend = p; *pend >= '0' && *pend <= '9'; pend++)
156+ ;;
157+
158+ /* Annoying encoding used by zone.tab has no decimal point, so use
159+ * the length to determine the format:
160+ *
161+ * 4 = DDMM
162+ * 5 = DDDMM
163+ * 6 = DDMMSS
164+ * 7 = DDDMMSS
165+ */
166+ len = pend - p;
167+ if (len < 4 || len > 7) {
168+ return NULL;
169+ }
170+
171+ /* p => [D]DD */
172+ v = (p[0] - '0') * 10.0 + (p[1] - '0');
173+ p += 2;
174+ if (len == 5 || len == 7)
175+ v = v * 10.0 + (*p++ - '0');
176+ /* p => MM[SS] */
177+ v += (10.0 * (p[0] - '0')
178+ + p[1] - '0') / 60.0;
179+ p += 2;
180+ /* p => [SS] */
181+ if (len > 5) {
182+ v += (10.0 * (p[0] - '0')
183+ + p[1] - '0') / 3600.0;
184+ p += 2;
185+ }
186+
187+ /* Round to five decimal place, not because it's a good idea,
188+ * but, because the builtin data uses rounded data, so, match
189+ * that. */
a659fa18 190+ *result = trunc(v * sign * 100000.0) / 100000.0;
c0240cb1 191+
192+ return p;
193+}
194+
195+/* This function parses the zone.tab file to build up the mapping of
196+ * timezone to country code and geographic location, and returns a
197+ * hash table. The hash table is indexed by the function:
198+ *
199+ * tz_hash(timezone-name)
200+ */
201+static struct location_info **create_location_table(void)
202+{
203+ struct location_info **li, *i;
204+ char zone_tab[PATH_MAX];
205+ char line[512];
206+ FILE *fp;
207+
208+ strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab);
209+
210+ fp = fopen(zone_tab, "r");
211+ if (!fp) {
212+ return NULL;
213+ }
214+
215+ li = calloc(LOCINFO_HASH_SIZE, sizeof *li);
216+
217+ while (fgets(line, sizeof line, fp)) {
218+ char *p = line, *code, *name, *comment;
219+ uint32_t hash;
220+ double latitude, longitude;
221+
222+ while (isspace(*p))
223+ p++;
224+
225+ if (*p == '#' || *p == '\0' || *p == '\n')
226+ continue;
227+
228+ if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t')
229+ continue;
230+
231+ /* code => AA */
232+ code = p;
233+ p[2] = 0;
234+ p += 3;
235+
236+ /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */
237+ p = parse_iso6709(p, &latitude);
238+ if (!p) {
239+ continue;
240+ }
241+ p = parse_iso6709(p, &longitude);
242+ if (!p) {
243+ continue;
244+ }
245+
246+ if (!p || *p != '\t') {
247+ continue;
248+ }
249+
250+ /* name = string */
251+ name = ++p;
252+ while (*p != '\t' && *p && *p != '\n')
253+ p++;
254+
255+ *p++ = '\0';
256+
257+ /* comment = string */
258+ comment = p;
259+ while (*p != '\t' && *p && *p != '\n')
260+ p++;
261+
262+ if (*p == '\n' || *p == '\t')
263+ *p = '\0';
264+
265+ hash = tz_hash(name);
266+ i = malloc(sizeof *i);
267+ memcpy(i->code, code, 2);
268+ strncpy(i->name, name, sizeof i->name);
269+ i->comment = strdup(comment);
270+ i->longitude = longitude;
271+ i->latitude = latitude;
272+ i->next = li[hash];
273+ li[hash] = i;
274+ /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */
275+ }
276+
277+ fclose(fp);
278+
279+ return li;
280+}
281+
282+/* Return location info from hash table, using given timezone name.
283+ * Returns NULL if the name could not be found. */
284+const struct location_info *find_zone_info(struct location_info **li,
285+ const char *name)
286+{
287+ uint32_t hash = tz_hash(name);
288+ const struct location_info *l;
289+
290+ if (!li) {
291+ return NULL;
292+ }
293+
294+ for (l = li[hash]; l; l = l->next) {
539ed3cb 295+ if (timelib_strcasecmp(l->name, name) == 0)
c0240cb1 296+ return l;
297+ }
298+
299+ return NULL;
300+}
301+
302+/* Filter out some non-tzdata files and the posix/right databases, if
303+ * present. */
304+static int index_filter(const struct dirent *ent)
305+{
306+ return strcmp(ent->d_name, ".") != 0
307+ && strcmp(ent->d_name, "..") != 0
308+ && strcmp(ent->d_name, "posix") != 0
309+ && strcmp(ent->d_name, "posixrules") != 0
310+ && strcmp(ent->d_name, "right") != 0
cacce04b 311+ && strstr(ent->d_name, ".list") == NULL
c0240cb1 312+ && strstr(ent->d_name, ".tab") == NULL;
313+}
314+
315+static int sysdbcmp(const void *first, const void *second)
316+{
317+ const timelib_tzdb_index_entry *alpha = first, *beta = second;
318+
539ed3cb 319+ return timelib_strcasecmp(alpha->id, beta->id);
c0240cb1 320+}
321+
322+
323+/* Create the zone identifier index by trawling the filesystem. */
324+static void create_zone_index(timelib_tzdb *db)
325+{
326+ size_t dirstack_size, dirstack_top;
327+ size_t index_size, index_next;
328+ timelib_tzdb_index_entry *db_index;
329+ char **dirstack;
330+
331+ /* LIFO stack to hold directory entries to scan; each slot is a
332+ * directory name relative to the zoneinfo prefix. */
333+ dirstack_size = 32;
334+ dirstack = malloc(dirstack_size * sizeof *dirstack);
335+ dirstack_top = 1;
336+ dirstack[0] = strdup("");
337+
338+ /* Index array. */
339+ index_size = 64;
340+ db_index = malloc(index_size * sizeof *db_index);
341+ index_next = 0;
342+
343+ do {
344+ struct dirent **ents;
345+ char name[PATH_MAX], *top;
346+ int count;
347+
348+ /* Pop the top stack entry, and iterate through its contents. */
349+ top = dirstack[--dirstack_top];
350+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top);
351+
352+ count = php_scandir(name, &ents, index_filter, php_alphasort);
353+
354+ while (count > 0) {
355+ struct stat st;
356+ const char *leaf = ents[count - 1]->d_name;
357+
358+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s",
359+ top, leaf);
360+
361+ if (strlen(name) && stat(name, &st) == 0) {
362+ /* Name, relative to the zoneinfo prefix. */
363+ const char *root = top;
364+
365+ if (root[0] == '/') root++;
366+
367+ snprintf(name, sizeof name, "%s%s%s", root,
368+ *root ? "/": "", leaf);
369+
370+ if (S_ISDIR(st.st_mode)) {
371+ if (dirstack_top == dirstack_size) {
372+ dirstack_size *= 2;
373+ dirstack = realloc(dirstack,
374+ dirstack_size * sizeof *dirstack);
375+ }
376+ dirstack[dirstack_top++] = strdup(name);
377+ }
378+ else {
379+ if (index_next == index_size) {
380+ index_size *= 2;
381+ db_index = realloc(db_index,
382+ index_size * sizeof *db_index);
383+ }
384+
385+ db_index[index_next++].id = strdup(name);
386+ }
387+ }
388+
389+ free(ents[--count]);
390+ }
391+
392+ if (count != -1) free(ents);
393+ free(top);
394+ } while (dirstack_top);
395+
396+ qsort(db_index, index_next, sizeof *db_index, sysdbcmp);
397+
398+ db->index = db_index;
399+ db->index_size = index_next;
400+
401+ free(dirstack);
402+}
403+
404+#define FAKE_HEADER "1234\0??\1??"
405+#define FAKE_UTC_POS (7 - 4)
406+
407+/* Create a fake data segment for database 'sysdb'. */
408+static void fake_data_segment(timelib_tzdb *sysdb,
409+ struct location_info **info)
410+{
411+ size_t n;
412+ char *data, *p;
413+
414+ data = malloc(3 * sysdb->index_size + 7);
415+
416+ p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1);
417+
418+ for (n = 0; n < sysdb->index_size; n++) {
419+ const struct location_info *li;
420+ timelib_tzdb_index_entry *ent;
421+
422+ ent = (timelib_tzdb_index_entry *)&sysdb->index[n];
423+
424+ /* Lookup the timezone name in the hash table. */
425+ if (strcmp(ent->id, "UTC") == 0) {
426+ ent->pos = FAKE_UTC_POS;
427+ continue;
428+ }
429+
430+ li = find_zone_info(info, ent->id);
431+ if (li) {
432+ /* If found, append the BC byte and the
433+ * country code; set the position for this
434+ * section of timezone data. */
435+ ent->pos = (p - data) - 4;
436+ *p++ = '\1';
437+ *p++ = li->code[0];
438+ *p++ = li->code[1];
439+ }
440+ else {
441+ /* If not found, the timezone data can
442+ * point at the header. */
443+ ent->pos = 0;
444+ }
445+ }
446+
447+ sysdb->data = (unsigned char *)data;
448+}
449+
450+/* Returns true if the passed-in stat structure describes a
451+ * probably-valid timezone file. */
cacce04b 452+static int is_valid_tzfile(const struct stat *st, int fd)
c0240cb1 453+{
cacce04b
ER
454+ if (fd) {
455+ char buf[20];
456+ if (read(fd, buf, 20)!=20) {
457+ return 0;
458+ }
459+ lseek(fd, SEEK_SET, 0);
460+ if (memcmp(buf, "TZif", 4)) {
461+ return 0;
462+ }
463+ }
c0240cb1 464+ return S_ISREG(st->st_mode) && st->st_size > 20;
465+}
466+
a659fa18
ER
467+/* To allow timezone names to be used case-insensitively, find the
468+ * canonical name for this timezone, if possible. */
469+static const char *canonical_tzname(const char *timezone)
470+{
471+ if (timezonedb_system) {
472+ timelib_tzdb_index_entry *ent, lookup;
909e9211 473+
a659fa18 474+ lookup.id = (char *)timezone;
909e9211 475+
a659fa18
ER
476+ ent = bsearch(&lookup, timezonedb_system->index,
477+ timezonedb_system->index_size, sizeof lookup,
478+ sysdbcmp);
479+ if (ent) {
480+ return ent->id;
481+ }
482+ }
483+
484+ return timezone;
485+}
486+
c0240cb1 487+/* Return the mmap()ed tzfile if found, else NULL. On success, the
488+ * length of the mapped data is placed in *length. */
489+static char *map_tzfile(const char *timezone, size_t *length)
490+{
491+ char fname[PATH_MAX];
492+ struct stat st;
493+ char *p;
494+ int fd;
495+
496+ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) {
497+ return NULL;
498+ }
499+
a659fa18 500+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone));
cacce04b 501+
c0240cb1 502+ fd = open(fname, O_RDONLY);
503+ if (fd == -1) {
504+ return NULL;
cacce04b 505+ } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st, fd)) {
c0240cb1 506+ close(fd);
507+ return NULL;
508+ }
509+
510+ *length = st.st_size;
511+ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
512+ close(fd);
513+
514+ return p != MAP_FAILED ? p : NULL;
515+}
516+
517+#endif
518+
519+static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
520 {
521 int left = 0, right = tzdb->index_size - 1;
539ed3cb
AG
522
523@@ -437,9 +877,48 @@ static int seek_to_tz_position(const uns
c0240cb1 524 return 0;
525 }
526
a659fa18 527+static int seek_to_tz_position(const unsigned char **tzf, char *timezone,
c0240cb1 528+ char **map, size_t *maplen,
529+ const timelib_tzdb *tzdb)
530+{
361fb152 531+#ifdef HAVE_SYSTEM_TZDATA
c0240cb1 532+ if (tzdb == timezonedb_system) {
533+ char *orig;
534+
535+ orig = map_tzfile(timezone, maplen);
536+ if (orig == NULL) {
537+ return 0;
538+ }
a659fa18 539+
909e9211 540+ (*tzf) = (unsigned char *)orig;
c0240cb1 541+ *map = orig;
909e9211 542+ return 1;
c0240cb1 543+ }
a659fa18 544+ else
361fb152 545+#endif
a659fa18 546+ {
c0240cb1 547+ return inmem_seek_to_tz_position(tzf, timezone, tzdb);
548+ }
549+}
550+
551 const timelib_tzdb *timelib_builtin_db(void)
552 {
553+#ifdef HAVE_SYSTEM_TZDATA
554+ if (timezonedb_system == NULL) {
555+ timelib_tzdb *tmp = malloc(sizeof *tmp);
556+
557+ tmp->version = "0.system";
558+ tmp->data = NULL;
559+ create_zone_index(tmp);
560+ system_location_table = create_location_table();
a659fa18 561+ fake_data_segment(tmp, system_location_table);
c0240cb1 562+ timezonedb_system = tmp;
563+ }
564+
c0240cb1 565+ return timezonedb_system;
566+#else
567 return &timezonedb_builtin;
568+#endif
569 }
570
539ed3cb
AG
571 const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_tzdb *tzdb, int *count)
572@@ -451,7 +930,30 @@ const timelib_tzdb_index_entry *timelib_
c0240cb1 573 int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
574 {
575 const unsigned char *tzf;
576- return (seek_to_tz_position(&tzf, timezone, tzdb));
577+
578+#ifdef HAVE_SYSTEM_TZDATA
a659fa18
ER
579+ if (tzdb == timezonedb_system) {
580+ char fname[PATH_MAX];
581+ struct stat st;
582+
583+ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) {
584+ return 0;
585+ }
c0240cb1 586+
a659fa18
ER
587+ if (system_location_table) {
588+ if (find_zone_info(system_location_table, timezone) != NULL) {
589+ /* found in cache */
590+ return 1;
591+ }
592+ }
593+
594+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone));
595+
cacce04b 596+ return stat(fname, &st) == 0 && is_valid_tzfile(&st, 0);
a659fa18
ER
597+ }
598+#endif
909e9211 599+
c0240cb1 600+ return (inmem_seek_to_tz_position(&tzf, timezone, tzdb));
601 }
602
cacce04b 603 static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
539ed3cb 604@@ -493,12 +995,14 @@ static timelib_tzinfo* timelib_tzinfo_ct
cacce04b 605 timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code)
c0240cb1 606 {
607 const unsigned char *tzf;
608+ char *memmap = NULL;
609+ size_t maplen;
610 timelib_tzinfo *tmp;
a659fa18 611 int version;
cacce04b
ER
612 int transitions_result, types_result;
613 unsigned int type; /* TIMELIB_TZINFO_PHP or TIMELIB_TZINFO_ZONEINFO */
c0240cb1 614
615- if (seek_to_tz_position(&tzf, timezone, tzdb)) {
616+ if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) {
617 tmp = timelib_tzinfo_ctor(timezone);
618
cacce04b 619 version = read_preamble(&tzf, tmp, &type);
539ed3cb 620@@ -537,11 +1041,36 @@ timelib_tzinfo *timelib_parse_tzfile(cha
cacce04b 621 }
539ed3cb
AG
622 skip_posix_string(&tzf, tmp);
623
c0240cb1 624+#ifdef HAVE_SYSTEM_TZDATA
625+ if (memmap) {
626+ const struct location_info *li;
627+
628+ /* TZif-style - grok the location info from the system database,
629+ * if possible. */
630+
631+ if ((li = find_zone_info(system_location_table, timezone)) != NULL) {
909e9211
ER
632+ tmp->location.comments = timelib_strdup(li->comment);
633+ strncpy(tmp->location.country_code, li->code, 2);
c0240cb1 634+ tmp->location.longitude = li->longitude;
635+ tmp->location.latitude = li->latitude;
636+ tmp->bc = 1;
637+ }
638+ else {
cacce04b 639+ set_default_location_and_comments(&tzf, tmp);
c0240cb1 640+ }
641+
642+ /* Now done with the mmap segment - discard it. */
643+ munmap(memmap, maplen);
cacce04b
ER
644+ } else {
645+#endif
539ed3cb
AG
646 if (type == TIMELIB_TZINFO_PHP) {
647 read_location(&tzf, tmp);
cacce04b
ER
648 } else {
649 set_default_location_and_comments(&tzf, tmp);
650 }
651+#ifdef HAVE_SYSTEM_TZDATA
652+ }
c0240cb1 653+#endif
c0240cb1 654 } else {
cacce04b 655 *error_code = TIMELIB_ERROR_NO_SUCH_TIMEZONE;
c0240cb1 656 tmp = NULL;
This page took 0.103241 seconds and 4 git commands to generate.