projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* verify.h (verify_expr): Remove, replacing with:
[gnulib.git]
/
lib
/
mktime.c
diff --git
a/lib/mktime.c
b/lib/mktime.c
index
fa65e01
..
b2d9e52
100644
(file)
--- a/
lib/mktime.c
+++ b/
lib/mktime.c
@@
-1,6
+1,5
@@
/* Convert a `struct tm' to a time_t value.
/* Convert a `struct tm' to a time_t value.
- Copyright (C) 1993-1999, 2002, 2003, 2004, 2005 Free Software Foundation,
- Inc.
+ Copyright (C) 1993-1999, 2002-2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Eggert (eggert@twinsun.com).
This file is part of the GNU C Library.
Contributed by Paul Eggert (eggert@twinsun.com).
@@
-16,7
+15,7
@@
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Define this to have a standalone program to test this implementation of
mktime. */
/* Define this to have a standalone program to test this implementation of
mktime. */
@@
-38,10
+37,11
@@
#include <limits.h>
#include <limits.h>
+#include <string.h> /* For the real memcpy prototype. */
+
#if DEBUG
# include <stdio.h>
# include <stdlib.h>
#if DEBUG
# include <stdio.h>
# include <stdlib.h>
-# include <string.h>
/* Make it work even if the system's libc has its own mktime routine. */
# define mktime my_mktime
#endif /* DEBUG */
/* Make it work even if the system's libc has its own mktime routine. */
# define mktime my_mktime
#endif /* DEBUG */
@@
-228,13
+228,12
@@
static struct tm *
ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
time_t *t, struct tm *tp)
{
ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
time_t *t, struct tm *tp)
{
- struct tm *r;
+ struct tm *r
= convert (t, tp)
;
- if (!
(r = (*convert) (t, tp))
&& *t)
+ if (!
r
&& *t)
{
time_t bad = *t;
time_t ok = 0;
{
time_t bad = *t;
time_t ok = 0;
- struct tm tm;
/* BAD is a known unconvertible time_t, and OK is a known good one.
Use binary search to narrow the range between BAD and OK until
/* BAD is a known unconvertible time_t, and OK is a known good one.
Use binary search to narrow the range between BAD and OK until
@@
-244,11
+243,9
@@
ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
time_t mid = *t = (bad < 0
? bad + ((ok - bad) >> 1)
: ok + ((bad - ok) >> 1));
time_t mid = *t = (bad < 0
? bad + ((ok - bad) >> 1)
: ok + ((bad - ok) >> 1));
- if ((r = (*convert) (t, tp)))
- {
- tm = *r;
- ok = mid;
- }
+ r = convert (t, tp);
+ if (r)
+ ok = mid;
else
bad = mid;
}
else
bad = mid;
}
@@
-258,8
+255,7
@@
ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
/* The last conversion attempt failed;
revert to the most recent successful attempt. */
*t = ok;
/* The last conversion attempt failed;
revert to the most recent successful attempt. */
*t = ok;
- *tp = tm;
- r = tp;
+ r = convert (t, tp);
}
}
}
}
@@
-488,7
+484,7
@@
__mktime_internal (struct tm *tp,
t2 = t1 + sec_adjustment;
if (((t1 < t) != (sec_requested < 0))
| ((t2 < t1) != (sec_adjustment < 0))
t2 = t1 + sec_adjustment;
if (((t1 < t) != (sec_requested < 0))
| ((t2 < t1) != (sec_adjustment < 0))
- | !
(*convert)
(&t2, &tm))
+ | !
convert
(&t2, &tm))
return -1;
t = t2;
}
return -1;
t = t2;
}