bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 09/11] sys_socket: better 'inline'


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

* lib/sys_socket.c: New file.
* lib/sys_socket.in.h (_GL_SYS_SOCKET_INLINE):
New macro.  Replace all uses of 'static inline' with it.
Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
* m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Do not require AC_C_INLINE.
* modules/sys_socket (Files, lib_SOURCES): Add lib/sys_socket.c.
(Depends-on): Add extern-inline.
---
 ChangeLog           | 9 +++++++++
 lib/sys_socket.c    | 3 +++
 lib/sys_socket.in.h | 9 ++++++++-
 m4/sys_socket_h.m4  | 3 +--
 modules/sys_socket  | 3 +++
 5 files changed, 24 insertions(+), 3 deletions(-)
 create mode 100644 lib/sys_socket.c

diff --git a/ChangeLog b/ChangeLog
index c16ad3c..b051eab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-10-28  Paul Eggert  <address@hidden>
 
+       sys_socket: better 'inline'
+       * lib/sys_socket.c: New file.
+       * lib/sys_socket.in.h (_GL_SYS_SOCKET_INLINE):
+       New macro.  Replace all uses of 'static inline' with it.
+       Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+       * m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Do not require AC_C_INLINE.
+       * modules/sys_socket (Files, lib_SOURCES): Add lib/sys_socket.c.
+       (Depends-on): Add extern-inline.
+
        stdio: better 'inline'
        * lib/stdio.c: New file.
        * lib/stdio.in.h (_GL_STDIO_INLINE):
diff --git a/lib/sys_socket.c b/lib/sys_socket.c
new file mode 100644
index 0000000..3f017f8
--- /dev/null
+++ b/lib/sys_socket.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_SYS_SOCKET_INLINE _GL_EXTERN_INLINE
+#include "sys/socket.h"
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index c9157d3..2b4c93f 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -63,6 +63,11 @@
 #ifndef address@hidden@_SYS_SOCKET_H
 #define address@hidden@_SYS_SOCKET_H
 
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_SYS_SOCKET_INLINE
+# define _GL_SYS_SOCKET_INLINE _GL_INLINE
+#endif
+
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
@@ -201,7 +206,7 @@ struct msghdr {
 
 /* Re-define FD_ISSET to avoid a WSA call while we are not using
    network sockets.  */
-static inline int
+_GL_SYS_SOCKET_INLINE int
 rpl_fd_isset (SOCKET fd, fd_set * set)
 {
   u_int i;
@@ -677,6 +682,8 @@ _GL_WARN_ON_USE (accept4, "accept4 is unportable - "
 # endif
 #endif
 
+_GL_INLINE_HEADER_END
+
 #endif /* address@hidden@_SYS_SOCKET_H */
 #endif /* address@hidden@_SYS_SOCKET_H */
 #endif
diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4
index 8d4e7e1..acfae41 100644
--- a/m4/sys_socket_h.m4
+++ b/m4/sys_socket_h.m4
@@ -1,4 +1,4 @@
-# sys_socket_h.m4 serial 22
+# sys_socket_h.m4 serial 23
 dnl Copyright (C) 2005-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,
@@ -10,7 +10,6 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET],
 [
   AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
   AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_REQUIRE([AC_C_INLINE])
 
   dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have
   dnl old-style declarations (with return type 'int' instead of 'ssize_t')
diff --git a/modules/sys_socket b/modules/sys_socket
index 704f2a5..df78751 100644
--- a/modules/sys_socket
+++ b/modules/sys_socket
@@ -2,12 +2,14 @@ Description:
 A POSIX-like <sys/socket.h>.
 
 Files:
+lib/sys_socket.c
 lib/sys_socket.in.h
 m4/sys_socket_h.m4
 m4/sockpfaf.m4
 
 Depends-on:
 errno
+extern-inline
 include_next
 snippet/arg-nonnull
 snippet/c++defs
@@ -23,6 +25,7 @@ AC_PROG_MKDIR_P
 
 Makefile.am:
 BUILT_SOURCES += sys/socket.h
+lib_SOURCES += sys_socket.c
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-- 
1.7.11.7




reply via email to

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