From 52f00e4396ef3d5f47122233da72feb932ce3f8e Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Thu, 14 Sep 2000 13:52:43 +0000 Subject: Introduce a few macros to handle timestamps in an abstract way. Replace the time stamp hash in dir.c with an open hashing structure. In doing so, remove some nasty casts, simplify code a bit: Dir_MTime can return a modification time, since make does not make a distinction between out-of-date and non-existent files. --- usr.bin/make/make.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'usr.bin/make/make.h') diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h index 386ba0b8c65..9592bfeb28d 100644 --- a/usr.bin/make/make.h +++ b/usr.bin/make/make.h @@ -1,4 +1,4 @@ -/* $OpenBSD: make.h,v 1.26 2000/09/14 13:40:03 espie Exp $ */ +/* $OpenBSD: make.h,v 1.27 2000/09/14 13:52:42 espie Exp $ */ /* $NetBSD: make.h,v 1.15 1997/03/10 21:20:00 christos Exp $ */ /* @@ -90,6 +90,25 @@ #include "config.h" #include "buf.h" +typedef time_t TIMESTAMP; +#define is_out_of_date(t) ((t) == INT_MIN) +#define set_out_of_date(t) (t) = INT_MIN +#define grab_stat(s, t) \ +do { \ + (t) = (s).st_mtime; \ + if (is_out_of_date(t)) \ + (t)++; \ +} while (0) +#define is_before(t1, t2) ((t1) < (t2)) +#define grab_date(d, t) \ +do { \ + (t) = d; \ + if (is_out_of_date(t)) \ + (t)++; \ +} while (0) +#define grab(n) time(&(n)) +#define timestamp2time_t(t) (t) + #define OUT_OF_DATE INT_MIN /* Variables that are kept in local GNodes. */ -- cgit v1.2.3