-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eric Blake on 10/30/2009 6:52 PM: >> How about moving this declaration to a new file mktime-internal.h? > > And share it between the mktime and timegm modules. Yes, that sounds nice.
Done. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkrvskIACgkQ84KuGfSFAYBPigCgm6b3ClOTohj45rJ1PfbdEj8L yO0AoNUlP/KpEJpsirRO9Ca8MU1GRysa =4emS -----END PGP SIGNATURE-----
From c69650b6a6e7e183d6786e40f347d5ac960f7ef9 Mon Sep 17 00:00:00 2001 From: Eric Blake <e...@byu.net> Date: Mon, 2 Nov 2009 11:39:38 -0700 Subject: [PATCH] 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 <e...@byu.net> --- ChangeLog | 10 ++++++++++ lib/mktime-internal.h | 4 ++++ lib/mktime.c | 4 +--- lib/timegm.c | 6 ++---- modules/mktime | 1 + modules/timegm | 1 + 6 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 lib/mktime-internal.h diff --git a/ChangeLog b/ChangeLog index ebbf68f..f457a2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2009-11-02 Eric Blake <e...@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. + +2009-11-02 Eric Blake <e...@byu.net> + 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. diff --git a/lib/mktime-internal.h b/lib/mktime-internal.h new file mode 100644 index 0000000..4287acf --- /dev/null +++ b/lib/mktime-internal.h @@ -0,0 +1,4 @@ +#include <time.h> +time_t mktime_internal (struct tm *, + struct tm * (*) (time_t const *, struct tm *), + time_t *); diff --git a/lib/mktime.c b/lib/mktime.c index 8690329..b9b961f 100644 --- a/lib/mktime.c +++ b/lib/mktime.c @@ -147,9 +147,7 @@ const unsigned short int __mon_yday[2][13] = # 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) - diff --git a/lib/timegm.c b/lib/timegm.c index 67230cf..94d3fa0 100644 --- a/lib/timegm.c +++ b/lib/timegm.c @@ -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 diff --git a/modules/mktime b/modules/mktime index 7a5165b..037f4e4 100644 --- a/modules/mktime +++ b/modules/mktime @@ -2,6 +2,7 @@ Description: mktime() function: convert broken-down time to linear time. Files: +lib/mktime-internal.h lib/mktime.c m4/mktime.m4 diff --git a/modules/timegm b/modules/timegm index 27eab44..f1de726 100644 --- a/modules/timegm +++ b/modules/timegm @@ -2,6 +2,7 @@ Description: Convert calendar time to simple time, inverse of mktime. Files: +lib/mktime-internal.h lib/timegm.c m4/timegm.m4 -- 1.6.5.rc1