diff options
| author | 2016-12-14 02:49:55 +0100 | |
|---|---|---|
| committer | 2016-12-14 02:49:55 +0100 | |
| commit | d53d0412e014872b71dd9c91727234de4f08fb2f (patch) | |
| tree | ec03b25a1d712bf23b78a613384c75a9191bb272 | |
| parent | ae8b7a0f1a5cf569f52f35fc1f113d0c4f354f6e (diff) | |
| download | libplist-d53d0412e014872b71dd9c91727234de4f08fb2f.tar.gz libplist-d53d0412e014872b71dd9c91727234de4f08fb2f.tar.bz2 | |
Properly check for the availability of strptime() and make sure to use it
| -rw-r--r-- | configure.ac | 2 | ||||
| -rw-r--r-- | src/xplist.c | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index d100b81..4eb1032 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -48,7 +48,7 @@ AC_TYPE_UINT32_T | |||
| 48 | AC_TYPE_UINT8_T | 48 | AC_TYPE_UINT8_T |
| 49 | 49 | ||
| 50 | # Checks for library functions. | 50 | # Checks for library functions. |
| 51 | AC_CHECK_FUNCS([asprintf strcasecmp strdup strerror strndup stpcpy vasprintf gmtime_r localtime_r timegm]) | 51 | AC_CHECK_FUNCS([asprintf strcasecmp strdup strerror strndup stpcpy vasprintf gmtime_r localtime_r timegm strptime]) |
| 52 | 52 | ||
| 53 | # Checking endianness | 53 | # Checking endianness |
| 54 | AC_C_BIGENDIAN([AC_DEFINE([__BIG_ENDIAN__], [1], [big endian])], | 54 | AC_C_BIGENDIAN([AC_DEFINE([__BIG_ENDIAN__], [1], [big endian])], |
diff --git a/src/xplist.c b/src/xplist.c index dc824e2..43b0422 100644 --- a/src/xplist.c +++ b/src/xplist.c | |||
| @@ -25,6 +25,10 @@ | |||
| 25 | #include <config.h> | 25 | #include <config.h> |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | #ifdef HAVE_STRPTIME | ||
| 29 | #define _XOPEN_SOURCE 600 | ||
| 30 | #endif | ||
| 31 | |||
| 28 | #include <string.h> | 32 | #include <string.h> |
| 29 | #include <assert.h> | 33 | #include <assert.h> |
| 30 | #include <stdlib.h> | 34 | #include <stdlib.h> |
| @@ -354,7 +358,7 @@ static void parse_date(const char *strval, struct TM *btime) | |||
| 354 | if (!btime) return; | 358 | if (!btime) return; |
| 355 | memset(btime, 0, sizeof(struct tm)); | 359 | memset(btime, 0, sizeof(struct tm)); |
| 356 | if (!strval) return; | 360 | if (!strval) return; |
| 357 | #ifdef strptime | 361 | #ifdef HAVE_STRPTIME |
| 358 | strptime((char*)strval, "%Y-%m-%dT%H:%M:%SZ", btime); | 362 | strptime((char*)strval, "%Y-%m-%dT%H:%M:%SZ", btime); |
| 359 | #else | 363 | #else |
| 360 | #ifdef USE_TM64 | 364 | #ifdef USE_TM64 |
