X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=date.c;h=44f5a99acd8bb509b8058c20c0b482d93ab61c2b;hp=7fdbb7101cf4d447ec649f225ef512cbc5c84af8;hb=1726c5c814aecd924849a0b91c82d420af945827;hpb=8e4e0559e74262c3e24f832e5cf729287be205c7 diff --git a/date.c b/date.c index 7fdbb710..44f5a99a 100644 --- a/date.c +++ b/date.c @@ -27,6 +27,8 @@ #include +#include /* For g_ascii_strncasecmp only. */ + #ifndef FALSE #define FALSE 0 #endif @@ -77,7 +79,7 @@ static unsigned char gmime_datetok_table[256] = { /* hrm, is there a library for this stuff? */ static struct { - char *name; + const char *name; int offset; } tz_offsets [] = { { "UT", 0 }, @@ -97,12 +99,12 @@ static struct { { "Y", 1200 }, }; -static char *tm_months[] = { +static const char *tm_months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -static char *tm_days[] = { +static const char *tm_days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; @@ -643,12 +645,15 @@ notmuch_parse_date (const char *str, int *tz_offset) { date_token *token, *tokens; time_t date; - + + if (str == NULL) + return 0; + if (!(tokens = datetok (str))) { if (tz_offset) *tz_offset = 0; - return (time_t) 0; + return 0; } if (!(date = parse_rfc822_date (tokens, tz_offset)))