summaryrefslogtreecommitdiff
path: root/src/network/sd-network.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-07-17 01:39:46 +0200
committerLennart Poettering <lennart@poettering.net>2014-07-17 01:42:26 +0200
commita2ba62c719224a4b47751623ca5e8b0333f49721 (patch)
tree9d8d2332a7c63ab55089e83c6fd82ca85bd73efc /src/network/sd-network.c
parentb45d9e86e41c453e0b57f2f8316bef06dee42e5a (diff)
sd-network: remove redundant array size parameter from functions that return arrays
As long as the number of array entries is relatively small it's nicer to simply return the number of entries directly, instead of using a size_t* return parameter for it.
Diffstat (limited to 'src/network/sd-network.c')
-rw-r--r--src/network/sd-network.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/network/sd-network.c b/src/network/sd-network.c
index 2057e53774..317d087b98 100644
--- a/src/network/sd-network.c
+++ b/src/network/sd-network.c
@@ -168,13 +168,12 @@ _public_ int sd_network_get_dhcp_lease(unsigned index, sd_dhcp_lease **ret) {
return 0;
}
-static int network_get_in_addr(const char *key, unsigned index, struct in_addr **addr, size_t *addr_size) {
+static int network_get_in_addr(const char *key, unsigned index, struct in_addr **addr) {
_cleanup_free_ char *p = NULL, *s = NULL;
int r;
assert_return(index, -EINVAL);
assert_return(addr, -EINVAL);
- assert_return(addr_size, -EINVAL);
if (asprintf(&p, "/run/systemd/netif/links/%u", index) < 0)
return -ENOMEM;
@@ -185,24 +184,23 @@ static int network_get_in_addr(const char *key, unsigned index, struct in_addr *
else if (!s)
return -EIO;
- return deserialize_in_addrs(addr, addr_size, s);
+ return deserialize_in_addrs(addr, s);
}
-_public_ int sd_network_get_dns(unsigned index, struct in_addr **addr, size_t *addr_size) {
- return network_get_in_addr("DNS", index, addr, addr_size);
+_public_ int sd_network_get_dns(unsigned index, struct in_addr **addr) {
+ return network_get_in_addr("DNS", index, addr);
}
-_public_ int sd_network_get_ntp(unsigned index, struct in_addr **addr, size_t *addr_size) {
- return network_get_in_addr("NTP", index, addr, addr_size);
+_public_ int sd_network_get_ntp(unsigned index, struct in_addr **addr) {
+ return network_get_in_addr("NTP", index, addr);
}
-static int network_get_in6_addr(const char *key, unsigned index, struct in6_addr **addr, size_t *addr_size) {
+static int network_get_in6_addr(const char *key, unsigned index, struct in6_addr **addr) {
_cleanup_free_ char *p = NULL, *s = NULL;
int r;
assert_return(index, -EINVAL);
assert_return(addr, -EINVAL);
- assert_return(addr_size, -EINVAL);
if (asprintf(&p, "/run/systemd/netif/links/%u", index) < 0)
return -ENOMEM;
@@ -213,15 +211,15 @@ static int network_get_in6_addr(const char *key, unsigned index, struct in6_addr
else if (!s)
return -EIO;
- return deserialize_in6_addrs(addr, addr_size, s);
+ return deserialize_in6_addrs(addr, s);
}
-_public_ int sd_network_get_dns6(unsigned index, struct in6_addr **addr, size_t *addr_size) {
- return network_get_in6_addr("DNS", index, addr, addr_size);
+_public_ int sd_network_get_dns6(unsigned index, struct in6_addr **addr) {
+ return network_get_in6_addr("DNS", index, addr);
}
-_public_ int sd_network_get_ntp6(unsigned index, struct in6_addr **addr, size_t *addr_size) {
- return network_get_in6_addr("NTP", index, addr, addr_size);
+_public_ int sd_network_get_ntp6(unsigned index, struct in6_addr **addr) {
+ return network_get_in6_addr("NTP", index, addr);
}
static int network_get_boolean(const char *key, unsigned index) {