chiark / gitweb /
shared: rename PROTO_ADDRESS_SIZE() to FAMILY_ADDRESS_SIZE()
authorLennart Poettering <lennart@poettering.net>
Fri, 18 Jul 2014 00:36:10 +0000 (02:36 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 18 Jul 2014 10:38:32 +0000 (12:38 +0200)
We mostly use "family" to refer to AF_INET, AF_INET6, etc, let's use
this terminology here, too

src/machine/machine-dbus.c
src/nss-myhostname/nss-myhostname.c
src/nss-mymachines/nss-mymachines.c
src/nss-resolve/nss-resolve.c
src/shared/in-addr-util.h

index 72e0a701bfd7cbe6b489719e5b7bfa9fb5a7c724..daa60d11e48912f75bdbe8b0501d21def4d5b0fd 100644 (file)
@@ -214,7 +214,7 @@ int bus_machine_method_get_addresses(sd_bus *bus, sd_bus_message *message, void
                 for (a = addresses, i = 0; i < n; a++, i++) {
                         struct iovec iov[2] = {
                                 { .iov_base = &a->family, .iov_len = sizeof(a->family) },
                 for (a = addresses, i = 0; i < n; a++, i++) {
                         struct iovec iov[2] = {
                                 { .iov_base = &a->family, .iov_len = sizeof(a->family) },
-                                { .iov_base = &a->address, .iov_len = PROTO_ADDRESS_SIZE(a->family) },
+                                { .iov_base = &a->address, .iov_len = FAMILY_ADDRESS_SIZE(a->family) },
                         };
 
                         r = writev(pair[1], iov, 2);
                         };
 
                         r = writev(pair[1], iov, 2);
index f5dadb60aae34a79543e6aec33a7a711a5239f36..6fa6790f529dec31b1282d425e94bd5786037203 100644 (file)
@@ -195,7 +195,7 @@ static enum nss_status fill_in_hostent(
         assert(errnop);
         assert(h_errnop);
 
         assert(errnop);
         assert(h_errnop);
 
-        alen = PROTO_ADDRESS_SIZE(af);
+        alen = FAMILY_ADDRESS_SIZE(af);
 
         for (a = addresses, n = 0, c = 0; n < n_addresses; a++, n++)
                 if (af == a->family)
 
         for (a = addresses, n = 0, c = 0; n < n_addresses; a++, n++)
                 if (af == a->family)
@@ -393,7 +393,7 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
                 return NSS_STATUS_UNAVAIL;
         }
 
                 return NSS_STATUS_UNAVAIL;
         }
 
-        if (len != PROTO_ADDRESS_SIZE(af)) {
+        if (len != FAMILY_ADDRESS_SIZE(af)) {
                 *errnop = EINVAL;
                 *h_errnop = NO_RECOVERY;
                 return NSS_STATUS_UNAVAIL;
                 *errnop = EINVAL;
                 *h_errnop = NO_RECOVERY;
                 return NSS_STATUS_UNAVAIL;
@@ -428,7 +428,7 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
                 if (af != a->family)
                         continue;
 
                 if (af != a->family)
                         continue;
 
-                if (memcmp(addr, &a->address, PROTO_ADDRESS_SIZE(af)) == 0)
+                if (memcmp(addr, &a->address, FAMILY_ADDRESS_SIZE(af)) == 0)
                         goto found;
         }
 
                         goto found;
         }
 
index eb1d2b450ba076ecfcf5d569525db68a190c32cb..09c5d05f2ecd98da008301013c1d434cf654c5de 100644 (file)
@@ -173,7 +173,7 @@ enum nss_status _nss_mymachines_gethostbyname4_r(
                         goto fail;
                 }
 
                         goto fail;
                 }
 
-                if (sz != PROTO_ADDRESS_SIZE(family)) {
+                if (sz != FAMILY_ADDRESS_SIZE(family)) {
                         r = -EINVAL;
                         goto fail;
                 }
                         r = -EINVAL;
                         goto fail;
                 }
@@ -281,7 +281,7 @@ enum nss_status _nss_mymachines_gethostbyname3_r(
                 return NSS_STATUS_NOTFOUND;
         }
 
                 return NSS_STATUS_NOTFOUND;
         }
 
-        alen = PROTO_ADDRESS_SIZE(af);
+        alen = FAMILY_ADDRESS_SIZE(af);
         l = strlen(name);
 
         ms = ALIGN(l+1) +
         l = strlen(name);
 
         ms = ALIGN(l+1) +
index 0dbc224b5c12af31eb61cd84897c986248719271..c67f59e17910efa9cc6d3fbf2bc54f4e65592dab 100644 (file)
@@ -207,7 +207,7 @@ enum nss_status _nss_resolve_gethostbyname4_r(
                 if (!IN_SET(family, AF_INET, AF_INET6))
                         continue;
 
                 if (!IN_SET(family, AF_INET, AF_INET6))
                         continue;
 
-                if (sz != PROTO_ADDRESS_SIZE(family)) {
+                if (sz != FAMILY_ADDRESS_SIZE(family)) {
                         r = -EINVAL;
                         goto fail;
                 }
                         r = -EINVAL;
                         goto fail;
                 }
@@ -329,7 +329,7 @@ enum nss_status _nss_resolve_gethostbyname3_r(
         if (isempty(canonical))
                 canonical = name;
 
         if (isempty(canonical))
                 canonical = name;
 
-        alen = PROTO_ADDRESS_SIZE(af);
+        alen = FAMILY_ADDRESS_SIZE(af);
         l = strlen(canonical);
 
         ms = ALIGN(l+1) +
         l = strlen(canonical);
 
         ms = ALIGN(l+1) +
@@ -463,7 +463,7 @@ enum nss_status _nss_resolve_gethostbyaddr2_r(
                 return NSS_STATUS_UNAVAIL;
         }
 
                 return NSS_STATUS_UNAVAIL;
         }
 
-        if (len != PROTO_ADDRESS_SIZE(af)) {
+        if (len != FAMILY_ADDRESS_SIZE(af)) {
                 *errnop = EINVAL;
                 *h_errnop = NO_RECOVERY;
                 return NSS_STATUS_UNAVAIL;
                 *errnop = EINVAL;
                 *h_errnop = NO_RECOVERY;
                 return NSS_STATUS_UNAVAIL;
index 108f1f3aceb65ad1b3953c9eda02d05808ce96c3..aae1f16608bc286c9131ffccf92412891e5d9832 100644 (file)
@@ -39,7 +39,7 @@ 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_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);
 
-static inline size_t PROTO_ADDRESS_SIZE(int proto) {
-        assert(proto == AF_INET || proto == AF_INET6);
-        return proto == AF_INET6 ? 16 : 4;
+static inline size_t FAMILY_ADDRESS_SIZE(int family) {
+        assert(family == AF_INET || family == AF_INET6);
+        return family == AF_INET6 ? 16 : 4;
 }
 }