changeset 12228:465038ef6bc4

mktime, timegm: share common declaration * lib/mktime-internal.h: New file. * lib/mktime.c: Use it rather than open-coding a declaration. * lib/timegm.c: Likewise. * modules/mktime (Files): Ship it. * modules/timegm (Files): Likewise. Suggested by Bruno Haible. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Mon, 02 Nov 2009 11:39:38 -0700
parents 84db083586d0
children fbf13e47327b
files ChangeLog lib/mktime-internal.h lib/mktime.c lib/timegm.c modules/mktime modules/timegm
diffstat 6 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Nov 02 10:23:33 2009 -0700
+++ b/ChangeLog	Mon Nov 02 11:39:38 2009 -0700
@@ -1,12 +1,20 @@
 2009-11-02  Eric Blake  <ebb9@byu.net>
 
+	mktime, timegm: share common declaration
+	* lib/mktime-internal.h: New file.
+	* lib/mktime.c: Use it rather than open-coding a declaration.
+	* lib/timegm.c: Likewise.
+	* modules/mktime (Files): Ship it.
+	* modules/timegm (Files): Likewise.
+	Suggested by Bruno Haible.
+
 	test-update-copyright: update test to match script changes
 	* tests/test-update-copyright.sh: Avoid hard-coding perl
 	location.  Don't update *.bak created by earlier runs.
 
 2009-11-02  Paul Eggert  <eggert@cs.ucla.edu>
-            Simon Josefsson  <simon@josefsson.org>
-            Bruno Haible  <bruno@clisp.org>
+	    Simon Josefsson  <simon@josefsson.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	Fix link error on Solaris 8.
 	* m4/inet_pton.m4 (gl_INET_PTON): Search for the function inet_pton
@@ -14,7 +22,7 @@
 	* modules/inet_pton (Link): New section.
 
 2009-11-02  Simon Josefsson  <simon@josefsson.org>
-            Bruno Haible  <bruno@clisp.org>
+	    Bruno Haible  <bruno@clisp.org>
 
 	* m4/inet_ntop.m4 (gl_INET_NTOP): Define also INET_NTOP_LIB.
 	* modules/inet_ntop (Link): New section.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/mktime-internal.h	Mon Nov 02 11:39:38 2009 -0700
@@ -0,0 +1,4 @@
+#include <time.h>
+time_t mktime_internal (struct tm *,
+                        struct tm * (*) (time_t const *, struct tm *),
+                        time_t *);
--- a/lib/mktime.c	Mon Nov 02 10:23:33 2009 -0700
+++ b/lib/mktime.c	Mon Nov 02 11:39:38 2009 -0700
@@ -147,9 +147,7 @@
 # undef __localtime_r
 # define __localtime_r localtime_r
 # define __mktime_internal mktime_internal
-time_t __mktime_internal (struct tm *,
-			  struct tm * (*) (time_t const *, struct tm *),
-			  time_t *);
+# include "mktime-internal.h"
 #endif
 
 /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
--- a/lib/timegm.c	Mon Nov 02 10:23:33 2009 -0700
+++ b/lib/timegm.c	Mon Nov 02 11:39:38 2009 -0700
@@ -1,6 +1,6 @@
 /* Convert UTC calendar time to simple time.  Like mktime but assumes UTC.
 
-   Copyright (C) 1994, 1997, 2003, 2004, 2006, 2007 Free Software
+   Copyright (C) 1994, 1997, 2003, 2004, 2006, 2007, 2009 Free Software
    Foundation, Inc.  This file is part of the GNU C Library.
 
    This program is free software; you can redistribute it and/or modify
@@ -27,9 +27,7 @@
 # undef __gmtime_r
 # define __gmtime_r gmtime_r
 # define __mktime_internal mktime_internal
-time_t __mktime_internal (struct tm *,
-			  struct tm * (*) (time_t const *, struct tm *),
-			  time_t *);
+# include "mktime-internal.h"
 #endif
 
 time_t
--- a/modules/mktime	Mon Nov 02 10:23:33 2009 -0700
+++ b/modules/mktime	Mon Nov 02 11:39:38 2009 -0700
@@ -2,6 +2,7 @@
 mktime() function: convert broken-down time to linear time.
 
 Files:
+lib/mktime-internal.h
 lib/mktime.c
 m4/mktime.m4
 
--- a/modules/timegm	Mon Nov 02 10:23:33 2009 -0700
+++ b/modules/timegm	Mon Nov 02 11:39:38 2009 -0700
@@ -2,6 +2,7 @@
 Convert calendar time to simple time, inverse of mktime.
 
 Files:
+lib/mktime-internal.h
 lib/timegm.c
 m4/timegm.m4