bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/5] timespec: use extern-inline


From: Paul Eggert
Subject: [PATCH 3/5] timespec: use extern-inline
Date: Sat, 28 Jul 2012 07:32:48 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0

* lib/timespec.c: New file.
* lib/timespec.h: Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
(_GL_TIMESPEC_INLINE): New macro.  Use it instead of 'static inline'.
* modules/timespec (Files): Add lib/timespec.c.
(Depends-on): Add extern-inline.
(lib_SOURCES): Add timespec.c.
---
 ChangeLog        |    8 ++++++++
 lib/timespec.c   |    3 +++
 lib/timespec.h   |   14 +++++++++++---
 modules/timespec |    3 +++
 4 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 lib/timespec.c

diff --git a/ChangeLog b/ChangeLog
index 1cd3a9b..4bdef35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2012-07-28  Paul Eggert  <address@hidden>
 
+       timespec: use extern-inline
+       * lib/timespec.c: New file.
+       * lib/timespec.h: Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+       (_GL_TIMESPEC_INLINE): New macro.  Use it instead of 'static inline'.
+       * modules/timespec (Files): Add lib/timespec.c.
+       (Depends-on): Add extern-inline.
+       (lib_SOURCES): Add timespec.c.
+
        stat-time: use extern-inline
        * lib/stat-time.c: New file.
        * lib/stat-time.h: Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
diff --git a/lib/timespec.c b/lib/timespec.c
new file mode 100644
index 0000000..16a7764
--- /dev/null
+++ b/lib/timespec.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_TIMESPEC_INLINE _GL_EXTERN_INLINE
+#include <timespec.h>
diff --git a/lib/timespec.h b/lib/timespec.h
index a587079..5a6d1c0 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -21,6 +21,8 @@
 
 # include <time.h>
 
+_GL_INLINE_HEADER_BEGIN
+
 /* Return negative, zero, positive if A < B, A == B, A > B, respectively.
 
    For each time stamp T, this code assumes that either:
@@ -49,7 +51,11 @@
 
    The (int) cast avoids a gcc -Wconversion warning.  */
 
-static inline int
+#ifndef _GL_TIMESPEC_INLINE
+# define _GL_TIMESPEC_INLINE _GL_INLINE
+#endif
+
+_GL_TIMESPEC_INLINE int
 timespec_cmp (struct timespec a, struct timespec b)
 {
   return (a.tv_sec < b.tv_sec ? -1
@@ -59,7 +65,7 @@ timespec_cmp (struct timespec a, struct timespec b)
 
 /* Return -1, 0, 1, depending on the sign of A.  A.tv_nsec must be
    nonnegative.  */
-static inline int
+_GL_TIMESPEC_INLINE int
 timespec_sign (struct timespec a)
 {
   return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
@@ -73,7 +79,7 @@ struct timespec dtotimespec (double)
   _GL_ATTRIBUTE_CONST;
 
 /* Return an approximation to A, of type 'double'.  */
-static inline double
+_GL_TIMESPEC_INLINE double
 timespectod (struct timespec a)
 {
   return a.tv_sec + a.tv_nsec / 1e9;
@@ -82,4 +88,6 @@ timespectod (struct timespec a)
 void gettime (struct timespec *);
 int settime (struct timespec const *);
 
+_GL_INLINE_HEADER_END
+
 #endif
diff --git a/modules/timespec b/modules/timespec
index 8d74632..176022c 100644
--- a/modules/timespec
+++ b/modules/timespec
@@ -3,15 +3,18 @@ timespec-related declarations
 
 Files:
 lib/timespec.h
+lib/timespec.c
 m4/timespec.m4
 
 Depends-on:
+extern-inline
 time
 
 configure.ac:
 gl_TIMESPEC
 
 Makefile.am:
+lib_SOURCES += timespec.c
 
 Include:
 "timespec.h"
-- 
1.7.6.5



reply via email to

[Prev in Thread] Current Thread [Next in Thread]