]> git.notmuchmail.org Git - notmuch/blobdiff - date.c
date.c: Add hard-coded definition of HAVE_TIMEZONE
[notmuch] / date.c
diff --git a/date.c b/date.c
index c6cbd813c444e770bfda2b51c89701417d96600d..ff1e1a6ac7671f2e88670ea866fd56db6a7af672 100644 (file)
--- a/date.c
+++ b/date.c
  * some glib-isms.
  */
 
  * some glib-isms.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#define _GNU_SOURCE
+#include "notmuch-private.h"
 
 
-#include <glib.h>
+#include <time.h>
 
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>      /* for MAXHOSTNAMELEN */
-#else
-#define MAXHOSTNAMELEN 64
-#endif
-#ifdef HAVE_UTSNAME_DOMAINNAME
-#include <sys/utsname.h>    /* for uname() */
+#ifndef FALSE
+#define FALSE 0
 #endif
 #endif
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>         /* Unix header for getpid() */
-#endif
-#ifdef G_OS_WIN32
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include <process.h>
-#define getpid() _getpid()
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
+
+#ifndef TRUE
+#define TRUE 1
 #endif
 #endif
-#include <ctype.h>
-#include <errno.h>
-
-#include "gmime-utils.h"
-#include "gmime-table-private.h"
-#include "gmime-parse-utils.h"
-#include "gmime-part.h"
-#include "gmime-charset.h"
-#include "gmime-iconv.h"
-#include "gmime-iconv-utils.h"
-
-#ifdef ENABLE_WARNINGS
-#define w(x) x
-#else
-#define w(x)
-#endif /* ENABLE_WARNINGS */
 
 #define d(x)
 
 
 #define d(x)
 
@@ -112,7 +75,7 @@ static unsigned char gmime_datetok_table[256] = {
        111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
 };
 
        111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
 };
 
-/* hrm, is there a library for this shit? */
+/* hrm, is there a library for this stuff? */
 static struct {
        char *name;
        int offset;
 static struct {
        char *name;
        int offset;
@@ -152,8 +115,8 @@ typedef struct _date_token {
        size_t len;
 } date_token;
 
        size_t len;
 } date_token;
 
-#define date_token_free(tok) g_slice_free (date_token, tok)
-#define date_token_new() g_slice_new (date_token)
+#define date_token_free(tok) free (tok)
+#define date_token_new() malloc (sizeof (date_token))
 
 static date_token *
 datetok (const char *date)
 
 static date_token *
 datetok (const char *date)
@@ -259,8 +222,9 @@ static int
 get_wday (const char *in, size_t inlen)
 {
        int wday;
 get_wday (const char *in, size_t inlen)
 {
        int wday;
-       
-       g_return_val_if_fail (in != NULL, -1);
+
+       if (in == NULL)
+               return -1;
        
        if (inlen < 3)
                return -1;
        
        if (inlen < 3)
                return -1;
@@ -278,7 +242,8 @@ get_mday (const char *in, size_t inlen)
 {
        int mday;
        
 {
        int mday;
        
-       g_return_val_if_fail (in != NULL, -1);
+       if (in == NULL)
+               return -1;
        
        mday = decode_int (in, inlen);
        
        
        mday = decode_int (in, inlen);
        
@@ -293,7 +258,8 @@ get_month (const char *in, size_t inlen)
 {
        int i;
        
 {
        int i;
        
-       g_return_val_if_fail (in != NULL, -1);
+       if (in == NULL)
+               return -1;
        
        if (inlen < 3)
                return -1;
        
        if (inlen < 3)
                return -1;
@@ -311,7 +277,8 @@ get_year (const char *in, size_t inlen)
 {
        int year;
        
 {
        int year;
        
-       g_return_val_if_fail (in != NULL, -1);
+       if (in == NULL)
+               return -1;
        
        if ((year = decode_int (in, inlen)) == -1)
                return -1;
        
        if ((year = decode_int (in, inlen)) == -1)
                return -1;
@@ -325,7 +292,7 @@ get_year (const char *in, size_t inlen)
        return year;
 }
 
        return year;
 }
 
-static gboolean
+static int
 get_time (const char *in, size_t inlen, int *hour, int *min, int *sec)
 {
        register const char *inptr;
 get_time (const char *in, size_t inlen, int *hour, int *min, int *sec)
 {
        register const char *inptr;
@@ -396,6 +363,8 @@ get_tzone (date_token **token)
        return -1;
 }
 
        return -1;
 }
 
+#define HAVE_TIMEZONE
+
 static time_t
 mktime_utc (struct tm *tm)
 {
 static time_t
 mktime_utc (struct tm *tm)
 {
@@ -442,7 +411,8 @@ parse_rfc822_date (date_token *tokens, int *tzone)
        struct tm tm;
        time_t t;
        
        struct tm tm;
        time_t t;
        
-       g_return_val_if_fail (tokens != NULL, (time_t) 0);
+       if (tokens == NULL)
+               return 0;
        
        token = tokens;
        
        
        token = tokens;
        
@@ -518,7 +488,7 @@ parse_rfc822_date (date_token *tokens, int *tzone)
 static time_t
 parse_broken_date (date_token *tokens, int *tzone)
 {
 static time_t
 parse_broken_date (date_token *tokens, int *tzone)
 {
-       gboolean got_wday, got_month, got_tzone;
+       int got_wday, got_month, got_tzone;
        int hour, min, sec, offset, n;
        date_token *token;
        struct tm tm;
        int hour, min, sec, offset, n;
        date_token *token;
        struct tm tm;