From: cheloha Date: Tue, 9 Apr 2024 15:08:21 +0000 (+0000) Subject: make(1): inline set_times() into Job_Touch() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7e440d195958617aa4d56ce3f25adf45e0335334;p=openbsd make(1): inline set_times() into Job_Touch() set_times() has one caller: Job_Touch(). set_times() is a thin utimes(2) wrapper. Using utimes(2) to reset a file's atime/mtime to the current time is not cumbersome. So, remove set_times() and just call utimes(2) directly. Thread: https://marc.info/?l=openbsd-tech&m=171262211713835&w=2 ok kn@ --- diff --git a/usr.bin/make/engine.c b/usr.bin/make/engine.c index a4c518601ac..45e824c74f1 100644 --- a/usr.bin/make/engine.c +++ b/usr.bin/make/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.73 2023/09/04 11:35:11 espie Exp $ */ +/* $OpenBSD: engine.c,v 1.74 2024/04/09 15:08:21 cheloha Exp $ */ /* * Copyright (c) 2012 Marc Espie. * @@ -262,7 +262,7 @@ Job_Touch(GNode *gn) } else { const char *file = gn->path != NULL ? gn->path : gn->name; - if (set_times(file) == -1){ + if (utimes(file, NULL) == -1){ if (rewrite_time(file) == -1) { (void)fprintf(stderr, "*** couldn't touch %s: %s", file, diff --git a/usr.bin/make/timestamp.c b/usr.bin/make/timestamp.c index 2029d6b62ad..38c47533cb4 100644 --- a/usr.bin/make/timestamp.c +++ b/usr.bin/make/timestamp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: timestamp.c,v 1.11 2023/09/04 11:35:11 espie Exp $ */ +/* $OpenBSD: timestamp.c,v 1.12 2024/04/09 15:08:21 cheloha Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -33,12 +33,6 @@ struct timespec starttime; -int -set_times(const char *f) -{ - return utimes(f, NULL); -} - #define PLACEHOLDER "XXXXXXXXX " char * time_to_string(struct timespec *t) diff --git a/usr.bin/make/timestamp.h b/usr.bin/make/timestamp.h index e54b76ecd1d..d46312b47a1 100644 --- a/usr.bin/make/timestamp.h +++ b/usr.bin/make/timestamp.h @@ -1,7 +1,7 @@ #ifndef TIMESTAMP_H #define TIMESTAMP_H -/* $OpenBSD: timestamp.h,v 1.11 2023/08/19 04:21:06 guenther Exp $ */ +/* $OpenBSD: timestamp.h,v 1.12 2024/04/09 15:08:21 cheloha Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -39,10 +39,6 @@ * ts_set_from_time_t(d, t): create timestamp from time_t. */ -/* sysresult = set_times(name): set modification times on a file. - * system call results. - */ - #define Init_Timestamp() clock_gettime(CLOCK_REALTIME, &starttime) #define TMIN (sizeof(time_t) == sizeof(int32_t) ? INT32_MIN : INT64_MIN) @@ -64,8 +60,6 @@ do { \ (t).tv_nsec++; \ } while (0) -extern int set_times(const char *); - extern struct timespec starttime; /* The time at the start * of this whole process */ extern char *time_to_string(struct timespec *);