diff options
Diffstat (limited to 'src/NetworkManagerUtils.c')
-rw-r--r-- | src/NetworkManagerUtils.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index fb273822ea..e6814e32e6 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -104,15 +104,15 @@ nm_utils_ip4_address_clear_host_address (in_addr_t addr, guint8 plen) * @src: source ip6 address * @plen: prefix length of network * - * Note: this function is self assignment save, to update @src inplace, set both + * Note: this function is self assignment safe, to update @src inplace, set both * @dst and @src to the same destination. */ -void +const struct in6_addr * nm_utils_ip6_address_clear_host_address (struct in6_addr *dst, const struct in6_addr *src, guint8 plen) { - g_return_if_fail (plen <= 128); - g_return_if_fail (src); - g_return_if_fail (dst); + g_return_val_if_fail (plen <= 128, NULL); + g_return_val_if_fail (src, NULL); + g_return_val_if_fail (dst, NULL); if (plen < 128) { guint nbytes = plen / 8; @@ -128,6 +128,8 @@ nm_utils_ip6_address_clear_host_address (struct in6_addr *dst, const struct in6_ memset (&dst->s6_addr[nbytes], 0, 16 - nbytes); } else if (src != dst) *dst = *src; + + return dst; } |