chiark / gitweb /
struct addrinfo varies in order between platforms, forcing us to fall
authorRichard Kettlewell <rjk@greenend.org.uk>
Sat, 26 Apr 2008 14:41:37 +0000 (15:41 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sat, 26 Apr 2008 14:41:37 +0000 (15:41 +0100)
back on C99 initializer syntax.  I don't think this will be a huge
problem in practice: all the currently supported platforms use GCC as
their default compiler, and all vaguely recent versions of GCC support
this feature.

clients/playrtp.c
lib/client-common.c
lib/sendmail.c
lib/t-addr.c
server/speaker-network.c
server/state.c
tests/udplog.c

index 31416ecff2fa00deff3f6d4225b0d7f17acab72f..6496daf5166d8dc586646e73b4acb1df29136775 100644 (file)
@@ -556,14 +556,10 @@ int main(int argc, char **argv) {
   const char *dumpfile = 0;
 
   static const struct addrinfo prefs = {
   const char *dumpfile = 0;
 
   static const struct addrinfo prefs = {
-    AI_PASSIVE,
-    PF_INET,
-    SOCK_DGRAM,
-    IPPROTO_UDP,
-    0,
-    0,
-    0,
-    0
+    .ai_flags = AI_PASSIVE,
+    .ai_family = PF_INET,
+    .ai_socktype = SOCK_DGRAM,
+    .ai_protocol = IPPROTO_UDP
   };
 
   mem_init();
   };
 
   mem_init();
index d2691298de514819372416353aa76063001860d8..f5ace3e6d7517e8e5dc69c5da2c6b680c2bdeee5 100644 (file)
@@ -48,14 +48,10 @@ socklen_t find_server(struct sockaddr **sap, char **namep) {
   socklen_t len;
    
   static const struct addrinfo pref = {
   socklen_t len;
    
   static const struct addrinfo pref = {
-    0,
-    PF_INET,
-    SOCK_STREAM,
-    IPPROTO_TCP,
-    0,
-    0,
-    0,
-    0
+    .ai_flags = 0,
+    .ai_family = PF_INET,
+    .ai_socktype = SOCK_STREAM,
+    .ai_protocol = IPPROTO_TCP,
   };
 
   if(config->connect.n) {
   };
 
   if(config->connect.n) {
index 95ad2a1dcc5cb7b2d60a3e9f29cc2fd756fd6e8c..2e0df8f933ba531873ec18f519366e4922c579b5 100644 (file)
@@ -210,14 +210,10 @@ int sendmail(const char *sender,
   FILE *in, *out;
    
   static const struct addrinfo pref = {
   FILE *in, *out;
    
   static const struct addrinfo pref = {
-    0,
-    PF_INET,
-    SOCK_STREAM,
-    IPPROTO_TCP,
-    0,
-    0,
-    0,
-    0
+    .ai_flags = 0,
+    .ai_family = PF_INET,
+    .ai_socktype = SOCK_STREAM,
+    .ai_protocol = IPPROTO_TCP,
   };
 
   /* Find the SMTP server */
   };
 
   /* Find the SMTP server */
index 8b7314d091642e87eaa2e32f9a907c4e5ffffdee..e609cd9465ebf44f6f8405441e412cb6cb1340a7 100644 (file)
@@ -29,14 +29,9 @@ void test_addr(void) {
   struct sockaddr_un su;
 
   static const struct addrinfo pref = {
   struct sockaddr_un su;
 
   static const struct addrinfo pref = {
-    AI_PASSIVE,
-    PF_INET,
-    SOCK_STREAM,
-    0,
-    0,
-    0,
-    0,
-    0
+    .ai_flags = AI_PASSIVE,
+    .ai_family = PF_INET,
+    .ai_socktype = SOCK_STREAM,
   };
 
   struct sockaddr_in a1 = {
   };
 
   struct sockaddr_in a1 = {
index 73d59b805cacf13c6aa3f7a7265b05f1907e8ee8..b77334ce163c78edfc8fd61c7ebdaa35b61362a7 100644 (file)
@@ -84,24 +84,16 @@ static int audio_errors;
 static void network_init(void) {
   struct addrinfo *res, *sres;
   static const struct addrinfo pref = {
 static void network_init(void) {
   struct addrinfo *res, *sres;
   static const struct addrinfo pref = {
-    0,
-    PF_INET,
-    SOCK_DGRAM,
-    IPPROTO_UDP,
-    0,
-    0,
-    0,
-    0
+    .ai_flags = 0,
+    .ai_family = PF_INET,
+    .ai_socktype = SOCK_DGRAM,
+    .ai_protocol = IPPROTO_UDP,
   };
   static const struct addrinfo prefbind = {
   };
   static const struct addrinfo prefbind = {
-    AI_PASSIVE,
-    PF_INET,
-    SOCK_DGRAM,
-    IPPROTO_UDP,
-    0,
-    0,
-    0,
-    0
+    .ai_flags = AI_PASSIVE,
+    .ai_family = PF_INET,
+    .ai_socktype = SOCK_DGRAM,
+    .ai_protocol = IPPROTO_UDP,
   };
   static const int one = 1;
   int sndbuf, target_sndbuf = 131072;
   };
   static const int one = 1;
   int sndbuf, target_sndbuf = 131072;
index e9525561a84daf8d79c846b6864baa5da952ab6e..3adcf2b88fcf51ef1d651d5d0c00e0e7e8e5979e 100644 (file)
@@ -69,14 +69,10 @@ static void reset_socket(ev_source *ev) {
   char *name;
   
   static const struct addrinfo pref = {
   char *name;
   
   static const struct addrinfo pref = {
-    AI_PASSIVE,
-    PF_INET,
-    SOCK_STREAM,
-    IPPROTO_TCP,
-    0,
-    0,
-    0,
-    0
+    .ai_flags = AI_PASSIVE,
+    .ai_family = PF_INET,
+    .ai_socktype = SOCK_STREAM,
+    .ai_protocol = IPPROTO_TCP,
   };
 
   /* unix first */
   };
 
   /* unix first */
index 0aa8f595c4346e36a1316dd5f9bc2ceb41937943..7e580f2522ecf616f70de4e5ac661f9885c9c97e 100644 (file)
@@ -81,14 +81,10 @@ int main(int argc, char **argv) {
   fd_set fds;
   struct timeval tv;
   static const struct addrinfo pref = {
   fd_set fds;
   struct timeval tv;
   static const struct addrinfo pref = {
-    0,                         /* ai_flags */
-    AF_UNSPEC,                 /* ai_family */
-    SOCK_DGRAM,                        /* ai_socktype */
-    IPPROTO_UDP,               /* ai_protocol */
-    0,
-    0,
-    0,
-    0
+    .ai_flags = 0,
+    .ai_family = AF_UNSPEC,
+    .ai_socktype = SOCK_DGRAM,
+    .ai_protocol = IPPROTO_UDP,
   };
   
   set_progname(argv);
   };
   
   set_progname(argv);