bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 07/11] sigaction: better 'inline'


From: Paul Eggert
Subject: [PATCH 07/11] sigaction: better 'inline'
Date: Mon, 29 Oct 2012 00:17:22 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1

* lib/sig-handler.c: New file.
* lib/sig-handler.h (SIG_HANDLER_INLINE):
New macro.  Replace all uses of 'static inline' with it.
Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
* m4/sigaction.m4 (gl_PREREQ_SIG_HANDLER_H): Do not require AC_C_INLINE.
* modules/sigaction (Files, lib_SOURCES): Add lib/sig-handler.c.
(Depends-on): Add extern-inline.
---
 ChangeLog         | 9 +++++++++
 lib/sig-handler.c | 3 +++
 lib/sig-handler.h | 9 ++++++++-
 m4/sigaction.m4   | 7 ++-----
 modules/sigaction | 3 +++
 5 files changed, 25 insertions(+), 6 deletions(-)
 create mode 100644 lib/sig-handler.c

diff --git a/ChangeLog b/ChangeLog
index 5af7e53..c2fda94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-10-28  Paul Eggert  <address@hidden>
 
+       sigaction: better 'inline'
+       * lib/sig-handler.c: New file.
+       * lib/sig-handler.h (SIG_HANDLER_INLINE):
+       New macro.  Replace all uses of 'static inline' with it.
+       Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+       * m4/sigaction.m4 (gl_PREREQ_SIG_HANDLER_H): Do not require AC_C_INLINE.
+       * modules/sigaction (Files, lib_SOURCES): Add lib/sig-handler.c.
+       (Depends-on): Add extern-inline.
+
        selinux-h: better 'inline'
        * lib/se-context.c, lib/se-selinux.c: New files.
        * lib/getfilecon.c (map_to_failure): Omit 'inline' for static function.
diff --git a/lib/sig-handler.c b/lib/sig-handler.c
new file mode 100644
index 0000000..52c3621
--- /dev/null
+++ b/lib/sig-handler.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define SIG_HANDLER_INLINE _GL_EXTERN_INLINE
+#include "sig-handler.h"
diff --git a/lib/sig-handler.h b/lib/sig-handler.h
index 386135f..5bba138 100644
--- a/lib/sig-handler.h
+++ b/lib/sig-handler.h
@@ -20,13 +20,18 @@
 
 #include <signal.h>
 
+_GL_INLINE_HEADER_BEGIN
+#ifndef SIG_HANDLER_INLINE
+# define SIG_HANDLER_INLINE _GL_INLINE
+#endif
+
 /* Convenience type when working with signal handlers.  */
 typedef void (*sa_handler_t) (int);
 
 /* Return the handler of a signal, as a sa_handler_t value regardless
    of its true type.  The resulting function can be compared to
    special values like SIG_IGN but it is not portable to call it.  */
-static inline sa_handler_t
+SIG_HANDLER_INLINE sa_handler_t
 get_handler (struct sigaction const *a)
 {
 #ifdef SA_SIGINFO
@@ -41,4 +46,6 @@ get_handler (struct sigaction const *a)
   return a->sa_handler;
 }
 
+_GL_INLINE_HEADER_END
+
 #endif /* _GL_SIG_HANDLER_H */
diff --git a/m4/sigaction.m4 b/m4/sigaction.m4
index 171d3a4..18bfd03 100644
--- a/m4/sigaction.m4
+++ b/m4/sigaction.m4
@@ -1,4 +1,4 @@
-# sigaction.m4 serial 6
+# sigaction.m4 serial 7
 dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,7 +37,4 @@ AC_DEFUN([gl_PREREQ_SIGACTION],
 ])
 
 # Prerequisites of lib/sig-handler.h.
-AC_DEFUN([gl_PREREQ_SIG_HANDLER_H],
-[
-  AC_REQUIRE([AC_C_INLINE])
-])
+AC_DEFUN([gl_PREREQ_SIG_HANDLER_H], [:])
diff --git a/modules/sigaction b/modules/sigaction
index 2180766..4387482 100644
--- a/modules/sigaction
+++ b/modules/sigaction
@@ -4,9 +4,11 @@ POSIX compatible signal handlers.
 Files:
 lib/sigaction.c
 lib/sig-handler.h
+lib/sig-handler.c
 m4/sigaction.m4
 
 Depends-on:
+extern-inline
 signal-h
 sigprocmask     [test $HAVE_SIGACTION = 0]
 
@@ -19,6 +21,7 @@ fi
 gl_SIGNAL_MODULE_INDICATOR([sigaction])
 
 Makefile.am:
+lib_SOURCES += sig-handler.c
 
 Include:
 <signal.h>
-- 
1.7.11.7




reply via email to

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