Mercurial > hg > octave-lyh > gnulib-hg
changeset 17024:fc5763921b7d
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.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sat, 28 Jul 2012 07:18:23 -0700 |
parents | fc49ecfa5827 |
children | ca76418cc04d |
files | ChangeLog lib/timespec.c lib/timespec.h modules/timespec |
diffstat | 4 files changed, 25 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2012-08-01 Paul Eggert <eggert@cs.ucla.edu> + 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.
new file mode 100644 --- /dev/null +++ b/lib/timespec.c @@ -0,0 +1,3 @@ +#include <config.h> +#define _GL_TIMESPEC_INLINE _GL_EXTERN_INLINE +#include <timespec.h>
--- 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 @@ /* 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 @@ _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 @@ void gettime (struct timespec *); int settime (struct timespec const *); +_GL_INLINE_HEADER_END + #endif