Discussion:
make use of module 'utime-h'
(too old to reply)
Bruno Haible
2017-04-30 17:30:52 UTC
Permalink
Raw Message
A simple patch to make use of the new module 'utime-h'.


2017-04-29 Bruno Haible <***@clisp.org>

Make use of module 'utime-h'.
* modules/copy-file (Depends-on): Add utime-h.
* lib/copy-file.c: Assume that <utime.h> exists.
* m4/copy-file.m4 (gl_COPY_FILE): Don't test for <utime.h>.

* modules/utimens (Depends-on): Add utime-h.
* lib/utimens.c: Assume that <utime.h> exists.

diff --git a/lib/copy-file.c b/lib/copy-file.c
index f906dfa..b3f02a7 100644
--- a/lib/copy-file.c
+++ b/lib/copy-file.c
@@ -29,11 +29,7 @@
#include <unistd.h>

#if HAVE_UTIME || HAVE_UTIMES
-# if HAVE_UTIME_H
-# include <utime.h>
-# else
-# include <sys/utime.h>
-# endif
+# include <utime.h>
#endif

#include "error.h"
diff --git a/lib/utimens.c b/lib/utimens.c
index 3643668..5c6e404 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -30,14 +30,11 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
+#include <utime.h>

#include "stat-time.h"
#include "timespec.h"

-#if HAVE_UTIME_H
-# include <utime.h>
-#endif
-
/* Some systems (even some that do have <utime.h>) don't declare this
structure anywhere. */
#ifndef HAVE_STRUCT_UTIMBUF
diff --git a/m4/copy-file.m4 b/m4/copy-file.m4
index 892e32b..4b5db8a 100644
--- a/m4/copy-file.m4
+++ b/m4/copy-file.m4
@@ -1,4 +1,4 @@
-# copy-file.m4 serial 3
+# copy-file.m4 serial 4
dnl Copyright (C) 2003, 2009-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,6 +6,6 @@ dnl with or without modifications, as long as this notice is preserved.

AC_DEFUN([gl_COPY_FILE],
[
- AC_CHECK_HEADERS_ONCE([unistd.h utime.h])
+ AC_CHECK_HEADERS_ONCE([unistd.h])
AC_CHECK_FUNCS([chown utime utimes])
])
diff --git a/modules/copy-file b/modules/copy-file
index d59f216..7238f55 100644
--- a/modules/copy-file
+++ b/modules/copy-file
@@ -19,6 +19,7 @@ quote
safe-read
stdlib
unistd
+utime-h
xalloc

configure.ac:
diff --git a/modules/utimens b/modules/utimens
index f925034..b43872e 100644
--- a/modules/utimens
+++ b/modules/utimens
@@ -20,6 +20,7 @@ stdbool
sys_stat
sys_time
time
+utime-h

configure.ac:
gl_UTIMENS

Loading...