Download raw body.
make(1): inline set_times() into sole caller
In make(1), set_times() is utimes(2) by another name. set_times() has
only one caller: Job_Touch(). Setting atime/mtime to the current time
with utimes(2) is not cumbersome.
So, remove set_times() and call utimes(2) directly.
ok?
Index: engine.c
===================================================================
RCS file: /cvs/src/usr.bin/make/engine.c,v
diff -u -p -r1.73 engine.c
--- engine.c 4 Sep 2023 11:35:11 -0000 1.73
+++ engine.c 9 Apr 2024 00:12:37 -0000
@@ -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,
Index: timestamp.c
===================================================================
RCS file: /cvs/src/usr.bin/make/timestamp.c,v
diff -u -p -r1.11 timestamp.c
--- timestamp.c 4 Sep 2023 11:35:11 -0000 1.11
+++ timestamp.c 9 Apr 2024 00:12:37 -0000
@@ -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)
Index: timestamp.h
===================================================================
RCS file: /cvs/src/usr.bin/make/timestamp.h,v
diff -u -p -r1.11 timestamp.h
--- timestamp.h 19 Aug 2023 04:21:06 -0000 1.11
+++ timestamp.h 9 Apr 2024 00:12:37 -0000
@@ -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)
@@ -63,8 +59,6 @@ do { \
if (is_out_of_date(t)) \
(t).tv_nsec++; \
} while (0)
-
-extern int set_times(const char *);
extern struct timespec starttime; /* The time at the start
* of this whole process */
make(1): inline set_times() into sole caller