... and adapt functions that would cast away the new const qualifier. Given typedef virSocketAddr *virSocketAddrPtr; Compare the parse trees of the following two declarations: (a) const virSocketAddrPtr addr; (b) const virSocketAddr *addr; (a) parses as const virSocketAddrPtr addr | | | | | identifier | | | | typedef-name direct-declarator | | | | type-specifier declarator | | | type-qualifier declaration-specifiers init-declarator \ / | declaration-specifiers init-declarator-list \ / declaration The meaning of this declaration is "constant object called 'addr' with type 'virSocketAddrPtr'. That is, "const" does not penetrate "virSocketAddrPtr". It means /* constant pointer to variable object */ virSocketAddr *const addr; (b) parses as const virSocketAddr * addr | | | | | | | identifier | | | | | typedef-name pointer direct-declarator | | \ / | type-specifier declarator | | | type-qualifier declaration-specifiers init-declarator \ / | declaration-specifiers init-declarator-list \ / declaration It means /* variable pointer to constant object */ const virSocketAddr *addr; For now only functions "rooted" in iptablesFormatNetwork() are converted. Signed-off-by: Laszlo Ersek <lersek@xxxxxxxxxx> --- src/util/virsocketaddr.h | 4 ++-- src/util/viriptables.c | 2 +- src/util/virsocketaddr.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/virsocketaddr.h b/src/util/virsocketaddr.h index b28fe6c..14b3a8b 100644 --- a/src/util/virsocketaddr.h +++ b/src/util/virsocketaddr.h @@ -99,10 +99,10 @@ int virSocketAddrIsNetmask(virSocketAddrPtr netmask); int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2, virSocketAddrPtr netmask); -int virSocketAddrMask(const virSocketAddrPtr addr, +int virSocketAddrMask(const virSocketAddr *addr, const virSocketAddrPtr netmask, virSocketAddrPtr network); -int virSocketAddrMaskByPrefix(const virSocketAddrPtr addr, +int virSocketAddrMaskByPrefix(const virSocketAddr *addr, unsigned int prefix, virSocketAddrPtr network); int virSocketAddrBroadcast(const virSocketAddrPtr addr, diff --git a/src/util/viriptables.c b/src/util/viriptables.c index 0f57d66..52e2bde 100644 --- a/src/util/viriptables.c +++ b/src/util/viriptables.c @@ -241,7 +241,7 @@ iptablesRemoveUdpInput(int family, } -static char *iptablesFormatNetwork(virSocketAddr *netaddr, +static char *iptablesFormatNetwork(const virSocketAddr *netaddr, unsigned int prefix) { virSocketAddr network; diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c index 3e01baf..0d415df 100644 --- a/src/util/virsocketaddr.c +++ b/src/util/virsocketaddr.c @@ -399,7 +399,7 @@ int virSocketAddrIsNetmask(virSocketAddrPtr netmask) { * Returns 0 in case of success, or -1 on error. */ int -virSocketAddrMask(const virSocketAddrPtr addr, +virSocketAddrMask(const virSocketAddr *addr, const virSocketAddrPtr netmask, virSocketAddrPtr network) { @@ -445,7 +445,7 @@ virSocketAddrMask(const virSocketAddrPtr addr, * Returns 0 in case of success, or -1 on error. */ int -virSocketAddrMaskByPrefix(const virSocketAddrPtr addr, +virSocketAddrMaskByPrefix(const virSocketAddr *addr, unsigned int prefix, virSocketAddrPtr network) { -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list