From: Michael Tremer Date: Fri, 20 Nov 2020 18:44:42 +0000 (+0000) Subject: network: Remove deprecated loc_network_is_subnet_of function X-Git-Tag: 0.9.5~36 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Flibloc.git;a=commitdiff_plain;h=d6a5092f969bb3bd50d130d4ba64b4e4be2e61f6 network: Remove deprecated loc_network_is_subnet_of function Signed-off-by: Michael Tremer --- diff --git a/src/libloc.sym b/src/libloc.sym index 9f41c89..b2d8a31 100644 --- a/src/libloc.sym +++ b/src/libloc.sym @@ -118,7 +118,6 @@ global: loc_network_gt; loc_network_has_flag; loc_network_is_subnet; - loc_network_is_subnet_of; loc_network_match_asn; loc_network_match_country_code; loc_network_match_flag; diff --git a/src/loc/network.h b/src/loc/network.h index 7b2ae4c..b31c8a2 100644 --- a/src/loc/network.h +++ b/src/loc/network.h @@ -62,7 +62,6 @@ int loc_network_eq(struct loc_network* self, struct loc_network* other); int loc_network_gt(struct loc_network* self, struct loc_network* other); int loc_network_overlaps(struct loc_network* self, struct loc_network* other); int loc_network_is_subnet(struct loc_network* self, struct loc_network* other); -int loc_network_is_subnet_of(struct loc_network* self, struct loc_network* other); int loc_network_subnets(struct loc_network* network, struct loc_network** subnet1, struct loc_network** subnet2); struct loc_network_list* loc_network_exclude( struct loc_network* self, struct loc_network* other); diff --git a/src/network.c b/src/network.c index e52b58c..72b77e6 100644 --- a/src/network.c +++ b/src/network.c @@ -522,11 +522,6 @@ LOC_EXPORT int loc_network_is_subnet(struct loc_network* self, struct loc_networ return 1; } -// XXX DEPRECATED - I find this too difficult to use -LOC_EXPORT int loc_network_is_subnet_of(struct loc_network* self, struct loc_network* other) { - return loc_network_is_subnet(other, self); -} - LOC_EXPORT int loc_network_subnets(struct loc_network* network, struct loc_network** subnet1, struct loc_network** subnet2) { int r; @@ -589,7 +584,7 @@ static int __loc_network_exclude(struct loc_network* network, if (r) goto ERROR; - } else if (loc_network_is_subnet_of(other, subnet1)) { + } else if (loc_network_is_subnet(subnet1, other)) { r = loc_network_list_push(list, subnet2); if (r) goto ERROR; @@ -598,7 +593,7 @@ static int __loc_network_exclude(struct loc_network* network, if (r) goto ERROR; - } else if (loc_network_is_subnet_of(other, subnet2)) { + } else if (loc_network_is_subnet(subnet2, other)) { r = loc_network_list_push(list, subnet1); if (r) goto ERROR; @@ -645,7 +640,7 @@ LOC_EXPORT struct loc_network_list* loc_network_exclude( } // Other must be a subnet of self - if (!loc_network_is_subnet_of(other, self)) { + if (!loc_network_is_subnet(self, other)) { DEBUG(self->ctx, "Network %p is not contained in network %p\n", other, self); return NULL; @@ -726,7 +721,7 @@ LOC_EXPORT struct loc_network_list* loc_network_exclude_list( } // Drop this subnet if is a subnet of another subnet - if (loc_network_is_subnet_of(subnet, subnet_to_check)) { + if (loc_network_is_subnet(subnet_to_check, subnet)) { passed = 0; loc_network_unref(subnet); break; diff --git a/src/python/network.c b/src/python/network.c index 742b472..b6e92fb 100644 --- a/src/python/network.c +++ b/src/python/network.c @@ -194,7 +194,7 @@ static PyObject* Network_is_subnet_of(NetworkObject* self, PyObject* args) { if (!PyArg_ParseTuple(args, "O!", &NetworkType, &other)) return NULL; - if (loc_network_is_subnet_of(self->network, other->network)) + if (loc_network_is_subnet(other->network, self->network)) Py_RETURN_TRUE; Py_RETURN_FALSE;