Don't use undefined macro 'max'.
authorBruno Haible <bruno@clisp.org>
Fri, 8 May 2009 22:01:36 +0000 (00:01 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 8 May 2009 22:01:36 +0000 (00:01 +0200)
ChangeLog
lib/sys_socket.in.h

index a3e7c3b..2f2055d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-08  Bruno Haible  <bruno@clisp.org>
+
+       * lib/sys_socket.in.h (_SS_PADSIZE): Use a conditional expression
+       instead of 'max'.
+
 2009-05-08  Simon Josefsson  <simon@josefsson.org>
 
        * m4/sys_socket_h.m4: Test for ws2tcpip.h earlier, needed for
index 50d9d3d..0ce7e9b 100644 (file)
 #define _GL_SYS_SOCKET_H
 
 #if !@HAVE_STRUCT_SOCKADDR_STORAGE@
-#include <alignof.h>
+# include <alignof.h>
 /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on
    2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */
-#define __ss_aligntype  unsigned long int
-#define _SS_SIZE       256
-#define _SS_PADSIZE    (_SS_SIZE - (max (sizeof (sa_family_t),         \
-                                         alignof (__ss_aligntype))     \
-                                    + sizeof (__ss_aligntype)))
+# define __ss_aligntype unsigned long int
+# define _SS_SIZE 256
+# define _SS_PADSIZE \
+    (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype)     \
+                 ? sizeof (sa_family_t)                                \
+                 : alignof (__ss_aligntype))                           \
+                + sizeof (__ss_aligntype)))
 
 struct sockaddr_storage
 {