summaryrefslogtreecommitdiff
path: root/usr.bin/make/make.h
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2000-09-14 13:52:43 +0000
committerMarc Espie <espie@cvs.openbsd.org>2000-09-14 13:52:43 +0000
commit52f00e4396ef3d5f47122233da72feb932ce3f8e (patch)
tree3eb6b0c9bff2378bef6d289969deac7e031da6cc /usr.bin/make/make.h
parentcc11fcd76306cd4861949984c169afd9d9b1f759 (diff)
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.
Diffstat (limited to 'usr.bin/make/make.h')
-rw-r--r--usr.bin/make/make.h21
1 files changed, 20 insertions, 1 deletions
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. */