]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ipaddr/ng_ipaddr.h
{Add|Del}_Ban_Invite > {Add_To|Del_From}_List(): more generic
[ngircd-alex.git] / src / ipaddr / ng_ipaddr.h
index 6490a0747a9ac0f62ff4608c8d7cbaea9e8023a5..1f209ef9fb734ab4ac05b7d488c2a5ea1ebe7c4f 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * Functions for AF_ agnostic ipv4/ipv6 handling.
- *
  * (c) 2008 Florian Westphal <fw@strlen.de>, public domain.
  */
 
@@ -8,6 +6,12 @@
 #define NG_IPADDR_HDR
 #include "portab.h"
 
+/**
+ * @file
+ * Functions for AF_ agnostic ipv4/ipv6 handling (header).
+ */
+
+#include <assert.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 
@@ -58,10 +62,10 @@ ng_ipaddr_salen(const ng_ipaddr_t *a)
 #ifdef WANT_IPV6
        assert(a->sa.sa_family == AF_INET || a->sa.sa_family == AF_INET6);
        if (a->sa.sa_family == AF_INET6)
-               return sizeof(a->sin6);
+               return (socklen_t)sizeof(a->sin6);
 #endif
        assert(a->sin4.sin_family == AF_INET);
-       return sizeof(a->sin4);
+       return (socklen_t)sizeof(a->sin4);
 }
 
 
@@ -102,8 +106,11 @@ GLOBAL const char *ng_ipaddr_tostr PARAMS((const ng_ipaddr_t *addr));
 /* convert struct sockaddr to string. dest must be NG_INET_ADDRSTRLEN bytes long */
 GLOBAL bool ng_ipaddr_tostr_r PARAMS((const ng_ipaddr_t *addr, char *dest));
 #else
-static inline const char *
-ng_ipaddr_tostr(const ng_ipaddr_t *addr) { return inet_ntoa(addr->sin4.sin_addr); }
+static inline const char*
+ng_ipaddr_tostr(const ng_ipaddr_t *addr)
+{
+       return inet_ntoa(addr->sin4.sin_addr);
+}
 
 static inline bool
 ng_ipaddr_tostr_r(const ng_ipaddr_t *addr, char *d)
@@ -115,4 +122,3 @@ ng_ipaddr_tostr_r(const ng_ipaddr_t *addr, char *d)
 #endif
 
 /* -eof- */
-