Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/4394587ab0e9bcb51b6d482497c11c72da0723de
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/4394587ab0e9bcb51b6d482497c11c72da0723de
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/4394587ab0e9bcb51b6d482497c11c72da0723de

The branch, master has been updated
       via  4394587ab0e9bcb51b6d482497c11c72da0723de (commit)
      from  0e76523e4c12120870a03a5f51143c6283c2704e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=4394587ab0e9bcb51b6d482497c11c72da0723de
commit 4394587ab0e9bcb51b6d482497c11c72da0723de
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    Utils: Split time handling functions out of `utils.c` into `time.c`.

diff --git a/utils/Makefile b/utils/Makefile
index d6a6c64..b6eede4 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -1,8 +1,26 @@
 # utils sources
 
-S_UTILS := base64.c corestrings.c filename.c filepath.c hashtable.c    \
-       libdom.c locale.c log.c messages.c nsurl.c talloc.c url.c       \
-       utf8.c utils.c useragent.c bloom.c nsoption.c file.c idna.c     \
-       punycode.c
+S_UTILS := \
+       base64.c \
+       bloom.c \
+       corestrings.c \
+       file.c \
+       filename.c \
+       filepath.c \
+       hashtable.c \
+       idna.c \
+       libdom.c \
+       locale.c \
+       log.c \
+       messages.c \
+       nsoption.c \
+       nsurl.c \
+       punycode.c \
+       talloc.c \
+       time.c \
+       url.c \
+       useragent.c \
+       utf8.c \
+       utils.c
 
 S_UTILS := $(addprefix utils/,$(S_UTILS))
diff --git a/utils/time.c b/utils/time.c
new file mode 100644
index 0000000..cf8acc0
--- /dev/null
+++ b/utils/time.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2007 Rob Kendrick <[email protected]>
+ * Copyright 2004-2007 James Bursa <[email protected]>
+ * Copyright 2003 Phil Mellor <[email protected]>
+ * Copyright 2003 John M Bell <[email protected]>
+ * Copyright 2004 John Tytgat <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file utils/time.c
+ * \brief Implementation of time operations.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <curl/curl.h>
+
+#include "utils/errors.h"
+#include "utils/time.h"
+
+
+/* exported interface documented in utils/time.h */
+const char *rfc1123_date(time_t t)
+{
+       static char ret[30];
+
+       struct tm *tm = gmtime(&t);
+       const char *days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 
},
+               *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+                               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+       snprintf(ret, sizeof ret, "%s, %02d %s %d %02d:%02d:%02d GMT",
+                       days[tm->tm_wday], tm->tm_mday, months[tm->tm_mon],
+                       tm->tm_year + 1900, tm->tm_hour, tm->tm_min,
+                       tm->tm_sec);
+
+       return ret;
+}
+
+
+/* exported function documented in utils/time.h */
+int nsc_sntimet(char *str, size_t size, time_t *timep)
+{
+#ifndef HAVE_STRFTIME
+       long long val;
+       val = (long long)*timep;
+
+       return snprintf(str, size, "%lld", val);
+#else
+       struct tm *ltm;
+
+       ltm = localtime(timep);
+       if (ltm == NULL) {
+               return -1;
+       }
+
+       return strftime(str, size, "%s", ltm);
+#endif
+}
+
+
+/* exported function documented in utils/time.h */
+nserror nsc_snptimet(const char *str, size_t size, time_t *timep)
+{
+       time_t time_out;
+
+#ifndef HAVE_STRPTIME
+       char *rstr;
+
+       if (size < 1) {
+               return NSERROR_BAD_PARAMETER;
+       }
+
+       errno = 0;
+       time_out = (time_t)strtoll(str, &rstr, 10);
+
+       /* The conversion may have a range faliure or no digits were found */
+       if ((errno != 0) || (rstr == str)) {
+               return NSERROR_BAD_PARAMETER;
+       }
+
+#else
+       struct tm ltm;
+
+       if (size < 1) {
+               return NSERROR_BAD_PARAMETER;
+       }
+
+       if (strptime(str, "%s", &ltm) == NULL) {
+               return NSERROR_BAD_PARAMETER;
+       }
+
+       time_out = mktime(&ltm);
+
+#endif
+       *timep = time_out;
+
+       return NSERROR_OK;
+}
+
+
+/* exported function documented in utils/time.h */
+nserror nsc_strntimet(const char *str, size_t size, time_t *timep)
+{
+       time_t result;
+
+       result = curl_getdate(str, NULL);
+
+       if (result == -1) {
+               return NSERROR_INVALID;
+       }
+
+       *timep = result;
+
+       return NSERROR_OK;
+}
diff --git a/utils/utils.c b/utils/utils.c
index f2a0942..2a83e85 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -21,24 +21,12 @@
  */
 
 #include <assert.h>
-#include <ctype.h>
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <strings.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-#include <time.h>
-#include <errno.h>
-#include <curl/curl.h>
 
-#include "utils/config.h"
-#include "utils/log.h"
 #include "utils/messages.h"
-#include "utils/utf8.h"
-#include "utils/time.h"
-#include "utils/sys_time.h"
-#include "utils/inet.h"
 #include "utils/dirent.h"
 #include "utils/string.h"
 #include "utils/utils.h"
@@ -249,25 +237,6 @@ char *human_friendly_bytesize(unsigned long bsize) {
 }
 
 
-/* exported interface documented in utils/utils.h */
-const char *rfc1123_date(time_t t)
-{
-       static char ret[30];
-
-       struct tm *tm = gmtime(&t);
-       const char *days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 
},
-               *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-                               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-
-       snprintf(ret, sizeof ret, "%s, %02d %s %d %02d:%02d:%02d GMT",
-                       days[tm->tm_wday], tm->tm_mday, months[tm->tm_mon],
-                       tm->tm_year + 1900, tm->tm_hour, tm->tm_min,
-                       tm->tm_sec);
-
-       return ret;
-}
-
-
 #ifndef HAVE_STRCASESTR
 
 /**
@@ -501,79 +470,3 @@ int inet_pton(int af, const char *src, void *dst)
 
 
 #endif
-
-/* exported function documented in utils/time.h */
-int nsc_sntimet(char *str, size_t size, time_t *timep)
-{
-#ifndef HAVE_STRFTIME
-       long long val;
-       val = (long long)*timep;
-
-       return snprintf(str, size, "%lld", val);
-#else
-       struct tm *ltm;
-
-       ltm = localtime(timep);
-       if (ltm == NULL) {
-               return -1;
-       }
-
-       return strftime(str, size, "%s", ltm);
-#endif
-}
-
-/* exported function documented in utils/time.h */
-nserror nsc_snptimet(const char *str, size_t size, time_t *timep)
-{
-       time_t time_out;
-
-#ifndef HAVE_STRPTIME
-       char *rstr;
-
-       if (size < 1) {
-               return NSERROR_BAD_PARAMETER;
-       }
-
-       errno = 0;
-       time_out = (time_t)strtoll(str, &rstr, 10);
-
-       /* The conversion may have a range faliure or no digits were found */
-       if ((errno != 0) || (rstr == str)) {
-               return NSERROR_BAD_PARAMETER;
-       }
-
-#else
-       struct tm ltm;
-
-       if (size < 1) {
-               return NSERROR_BAD_PARAMETER;
-       }
-
-       if (strptime(str, "%s", &ltm) == NULL) {
-               return NSERROR_BAD_PARAMETER;
-       }
-
-       time_out = mktime(&ltm);
-
-#endif
-       *timep = time_out;
-
-       return NSERROR_OK;
-}
-
-
-/* exported function documented in utils/time.h */
-nserror nsc_strntimet(const char *str, size_t size, time_t *timep)
-{
-       time_t result;
-
-       result = curl_getdate(str, NULL);
-
-       if (result == -1) {
-               return NSERROR_INVALID;
-       }
-
-       *timep = result;
-
-       return NSERROR_OK;
-}


-----------------------------------------------------------------------

Summary of changes:
 utils/Makefile |   26 +++++++++--
 utils/time.c   |  132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 utils/utils.c  |  107 ---------------------------------------------
 3 files changed, 154 insertions(+), 111 deletions(-)
 create mode 100644 utils/time.c

diff --git a/utils/Makefile b/utils/Makefile
index d6a6c64..b6eede4 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -1,8 +1,26 @@
 # utils sources
 
-S_UTILS := base64.c corestrings.c filename.c filepath.c hashtable.c    \
-       libdom.c locale.c log.c messages.c nsurl.c talloc.c url.c       \
-       utf8.c utils.c useragent.c bloom.c nsoption.c file.c idna.c     \
-       punycode.c
+S_UTILS := \
+       base64.c \
+       bloom.c \
+       corestrings.c \
+       file.c \
+       filename.c \
+       filepath.c \
+       hashtable.c \
+       idna.c \
+       libdom.c \
+       locale.c \
+       log.c \
+       messages.c \
+       nsoption.c \
+       nsurl.c \
+       punycode.c \
+       talloc.c \
+       time.c \
+       url.c \
+       useragent.c \
+       utf8.c \
+       utils.c
 
 S_UTILS := $(addprefix utils/,$(S_UTILS))
diff --git a/utils/time.c b/utils/time.c
new file mode 100644
index 0000000..cf8acc0
--- /dev/null
+++ b/utils/time.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2007 Rob Kendrick <[email protected]>
+ * Copyright 2004-2007 James Bursa <[email protected]>
+ * Copyright 2003 Phil Mellor <[email protected]>
+ * Copyright 2003 John M Bell <[email protected]>
+ * Copyright 2004 John Tytgat <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file utils/time.c
+ * \brief Implementation of time operations.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <curl/curl.h>
+
+#include "utils/errors.h"
+#include "utils/time.h"
+
+
+/* exported interface documented in utils/time.h */
+const char *rfc1123_date(time_t t)
+{
+       static char ret[30];
+
+       struct tm *tm = gmtime(&t);
+       const char *days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 
},
+               *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+                               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+       snprintf(ret, sizeof ret, "%s, %02d %s %d %02d:%02d:%02d GMT",
+                       days[tm->tm_wday], tm->tm_mday, months[tm->tm_mon],
+                       tm->tm_year + 1900, tm->tm_hour, tm->tm_min,
+                       tm->tm_sec);
+
+       return ret;
+}
+
+
+/* exported function documented in utils/time.h */
+int nsc_sntimet(char *str, size_t size, time_t *timep)
+{
+#ifndef HAVE_STRFTIME
+       long long val;
+       val = (long long)*timep;
+
+       return snprintf(str, size, "%lld", val);
+#else
+       struct tm *ltm;
+
+       ltm = localtime(timep);
+       if (ltm == NULL) {
+               return -1;
+       }
+
+       return strftime(str, size, "%s", ltm);
+#endif
+}
+
+
+/* exported function documented in utils/time.h */
+nserror nsc_snptimet(const char *str, size_t size, time_t *timep)
+{
+       time_t time_out;
+
+#ifndef HAVE_STRPTIME
+       char *rstr;
+
+       if (size < 1) {
+               return NSERROR_BAD_PARAMETER;
+       }
+
+       errno = 0;
+       time_out = (time_t)strtoll(str, &rstr, 10);
+
+       /* The conversion may have a range faliure or no digits were found */
+       if ((errno != 0) || (rstr == str)) {
+               return NSERROR_BAD_PARAMETER;
+       }
+
+#else
+       struct tm ltm;
+
+       if (size < 1) {
+               return NSERROR_BAD_PARAMETER;
+       }
+
+       if (strptime(str, "%s", &ltm) == NULL) {
+               return NSERROR_BAD_PARAMETER;
+       }
+
+       time_out = mktime(&ltm);
+
+#endif
+       *timep = time_out;
+
+       return NSERROR_OK;
+}
+
+
+/* exported function documented in utils/time.h */
+nserror nsc_strntimet(const char *str, size_t size, time_t *timep)
+{
+       time_t result;
+
+       result = curl_getdate(str, NULL);
+
+       if (result == -1) {
+               return NSERROR_INVALID;
+       }
+
+       *timep = result;
+
+       return NSERROR_OK;
+}
diff --git a/utils/utils.c b/utils/utils.c
index f2a0942..2a83e85 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -21,24 +21,12 @@
  */
 
 #include <assert.h>
-#include <ctype.h>
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <strings.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-#include <time.h>
-#include <errno.h>
-#include <curl/curl.h>
 
-#include "utils/config.h"
-#include "utils/log.h"
 #include "utils/messages.h"
-#include "utils/utf8.h"
-#include "utils/time.h"
-#include "utils/sys_time.h"
-#include "utils/inet.h"
 #include "utils/dirent.h"
 #include "utils/string.h"
 #include "utils/utils.h"
@@ -249,25 +237,6 @@ char *human_friendly_bytesize(unsigned long bsize) {
 }
 
 
-/* exported interface documented in utils/utils.h */
-const char *rfc1123_date(time_t t)
-{
-       static char ret[30];
-
-       struct tm *tm = gmtime(&t);
-       const char *days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 
},
-               *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-                               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-
-       snprintf(ret, sizeof ret, "%s, %02d %s %d %02d:%02d:%02d GMT",
-                       days[tm->tm_wday], tm->tm_mday, months[tm->tm_mon],
-                       tm->tm_year + 1900, tm->tm_hour, tm->tm_min,
-                       tm->tm_sec);
-
-       return ret;
-}
-
-
 #ifndef HAVE_STRCASESTR
 
 /**
@@ -501,79 +470,3 @@ int inet_pton(int af, const char *src, void *dst)
 
 
 #endif
-
-/* exported function documented in utils/time.h */
-int nsc_sntimet(char *str, size_t size, time_t *timep)
-{
-#ifndef HAVE_STRFTIME
-       long long val;
-       val = (long long)*timep;
-
-       return snprintf(str, size, "%lld", val);
-#else
-       struct tm *ltm;
-
-       ltm = localtime(timep);
-       if (ltm == NULL) {
-               return -1;
-       }
-
-       return strftime(str, size, "%s", ltm);
-#endif
-}
-
-/* exported function documented in utils/time.h */
-nserror nsc_snptimet(const char *str, size_t size, time_t *timep)
-{
-       time_t time_out;
-
-#ifndef HAVE_STRPTIME
-       char *rstr;
-
-       if (size < 1) {
-               return NSERROR_BAD_PARAMETER;
-       }
-
-       errno = 0;
-       time_out = (time_t)strtoll(str, &rstr, 10);
-
-       /* The conversion may have a range faliure or no digits were found */
-       if ((errno != 0) || (rstr == str)) {
-               return NSERROR_BAD_PARAMETER;
-       }
-
-#else
-       struct tm ltm;
-
-       if (size < 1) {
-               return NSERROR_BAD_PARAMETER;
-       }
-
-       if (strptime(str, "%s", &ltm) == NULL) {
-               return NSERROR_BAD_PARAMETER;
-       }
-
-       time_out = mktime(&ltm);
-
-#endif
-       *timep = time_out;
-
-       return NSERROR_OK;
-}
-
-
-/* exported function documented in utils/time.h */
-nserror nsc_strntimet(const char *str, size_t size, time_t *timep)
-{
-       time_t result;
-
-       result = curl_getdate(str, NULL);
-
-       if (result == -1) {
-               return NSERROR_INVALID;
-       }
-
-       *timep = result;
-
-       return NSERROR_OK;
-}


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to