From 0dd25fb9f005d8ab7ac4bc10a609d00569f8c56a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 18 Jul 2014 16:09:30 +0200 Subject: change type for address family to "int" Let's settle on a single type for all address family values, even if UNIX is very inconsitent on the precise type otherwise. Given that socket() is the primary entrypoint for the sockets API, and that uses "int", and "int" is relatively simple and generic, we settle on "int" for this. --- src/shared/in-addr-util.c | 14 +++++++------- src/shared/in-addr-util.h | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/shared') diff --git a/src/shared/in-addr-util.c b/src/shared/in-addr-util.c index 0c6ebec336..ffbaa74316 100644 --- a/src/shared/in-addr-util.c +++ b/src/shared/in-addr-util.c @@ -23,7 +23,7 @@ #include "in-addr-util.h" -int in_addr_null(unsigned family, union in_addr_union *u) { +int in_addr_null(int family, union in_addr_union *u) { assert(u); if (family == AF_INET) @@ -40,7 +40,7 @@ int in_addr_null(unsigned family, union in_addr_union *u) { } -int in_addr_equal(unsigned family, union in_addr_union *a, union in_addr_union *b) { +int in_addr_equal(int family, union in_addr_union *a, union in_addr_union *b) { assert(a); assert(b); @@ -58,7 +58,7 @@ int in_addr_equal(unsigned family, union in_addr_union *a, union in_addr_union * } int in_addr_prefix_intersect( - unsigned family, + int family, const union in_addr_union *a, unsigned aprefixlen, const union in_addr_union *b, @@ -114,7 +114,7 @@ int in_addr_prefix_intersect( return -EAFNOSUPPORT; } -int in_addr_prefix_next(unsigned family, union in_addr_union *u, unsigned prefixlen) { +int in_addr_prefix_next(int family, union in_addr_union *u, unsigned prefixlen) { assert(u); /* Increases the network part of an address by one. Returns @@ -167,7 +167,7 @@ int in_addr_prefix_next(unsigned family, union in_addr_union *u, unsigned prefix return -EAFNOSUPPORT; } -int in_addr_to_string(unsigned family, const union in_addr_union *u, char **ret) { +int in_addr_to_string(int family, const union in_addr_union *u, char **ret) { char *x; size_t l; @@ -195,7 +195,7 @@ int in_addr_to_string(unsigned family, const union in_addr_union *u, char **ret) return 0; } -int in_addr_from_string(unsigned family, const char *s, union in_addr_union *ret) { +int in_addr_from_string(int family, const char *s, union in_addr_union *ret) { assert(s); assert(ret); @@ -210,7 +210,7 @@ int in_addr_from_string(unsigned family, const char *s, union in_addr_union *ret return 0; } -int in_addr_from_string_auto(const char *s, unsigned *family, union in_addr_union *ret) { +int in_addr_from_string_auto(const char *s, int *family, union in_addr_union *ret) { int r; assert(s); diff --git a/src/shared/in-addr-util.h b/src/shared/in-addr-util.h index 6cfdb14a89..d76ea9dc30 100644 --- a/src/shared/in-addr-util.h +++ b/src/shared/in-addr-util.h @@ -31,13 +31,13 @@ union in_addr_union { struct in6_addr in6; }; -int in_addr_null(unsigned family, union in_addr_union *u); -int in_addr_equal(unsigned family, union in_addr_union *a, union in_addr_union *b); -int in_addr_prefix_intersect(unsigned family, const union in_addr_union *a, unsigned aprefixlen, const union in_addr_union *b, unsigned bprefixlen); -int in_addr_prefix_next(unsigned family, union in_addr_union *u, unsigned prefixlen); -int in_addr_to_string(unsigned family, const union in_addr_union *u, char **ret); -int in_addr_from_string(unsigned family, const char *s, union in_addr_union *ret); -int in_addr_from_string_auto(const char *s, unsigned *family, union in_addr_union *ret); +int in_addr_null(int family, union in_addr_union *u); +int in_addr_equal(int family, union in_addr_union *a, union in_addr_union *b); +int in_addr_prefix_intersect(int family, const union in_addr_union *a, unsigned aprefixlen, const union in_addr_union *b, unsigned bprefixlen); +int in_addr_prefix_next(int family, union in_addr_union *u, unsigned prefixlen); +int in_addr_to_string(int family, const union in_addr_union *u, char **ret); +int in_addr_from_string(int family, const char *s, union in_addr_union *ret); +int in_addr_from_string_auto(const char *s, int *family, union in_addr_union *ret); static inline size_t FAMILY_ADDRESS_SIZE(int family) { assert(family == AF_INET || family == AF_INET6); -- cgit v1.2.3-54-g00ecf