]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
network: Rename "match" functions to "matches"
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Sep 2021 10:36:56 +0000 (10:36 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Sep 2021 10:36:56 +0000 (10:36 +0000)
Gramatically, this makes more sense.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.c
src/libloc.sym
src/libloc/network.h
src/network.c
src/test-country.c
src/test-network.c

index d37e70fb3bac6eb3a2f4cc9a2012c43b1db7cd2a..01c30c66da3a79270e38149ed4492da64ed6aaf0 100644 (file)
@@ -785,7 +785,7 @@ static int __loc_database_lookup_handle_leaf(struct loc_database* db, const stru
        }
 
        // Check if the given IP address is inside the network
-       if (!loc_network_match_address(*network, address)) {
+       if (!loc_network_matches_address(*network, address)) {
                DEBUG(db->ctx, "Searched address is not part of the network\n");
 
                loc_network_unref(*network);
index df6f4d804bcdf53b8cb684cfc576535bb8e0a0b6..975bb6297a0e630c628719290e2704981bc47f8e 100644 (file)
@@ -98,8 +98,8 @@ global:
        loc_network_get_last_address;
        loc_network_has_flag;
        loc_network_is_subnet;
-       loc_network_match_address;
-       loc_network_match_country_code;
+       loc_network_matches_address;
+       loc_network_matches_country_code;
        loc_network_new;
        loc_network_new_from_string;
        loc_network_overlaps;
index fcfa5480b23e725713b81f01dc939f1dbee1dff3..3b8b95f672613a6241a077d50b1a5b7f70916819 100644 (file)
@@ -45,11 +45,11 @@ const struct in6_addr* loc_network_get_first_address(struct loc_network* network
 char* loc_network_format_first_address(struct loc_network* network);
 const struct in6_addr* loc_network_get_last_address(struct loc_network* network);
 char* loc_network_format_last_address(struct loc_network* network);
-int loc_network_match_address(struct loc_network* network, const struct in6_addr* address);
+int loc_network_matches_address(struct loc_network* network, const struct in6_addr* address);
 
 const char* loc_network_get_country_code(struct loc_network* network);
 int loc_network_set_country_code(struct loc_network* network, const char* country_code);
-int loc_network_match_country_code(struct loc_network* network, const char* country_code);
+int loc_network_matches_country_code(struct loc_network* network, const char* country_code);
 
 uint32_t loc_network_get_asn(struct loc_network* network);
 int loc_network_set_asn(struct loc_network* network, uint32_t asn);
index de024ccfda9980bc892374f0fd6fff9fbf806e34..4b2b279c76e357daf36295b7fbb2c799491739c7 100644 (file)
@@ -353,7 +353,7 @@ LOC_EXPORT char* loc_network_format_last_address(struct loc_network* network) {
        return loc_network_format_address(network, &network->last_address);
 }
 
-LOC_EXPORT int loc_network_match_address(struct loc_network* network, const struct in6_addr* address) {
+LOC_EXPORT int loc_network_matches_address(struct loc_network* network, const struct in6_addr* address) {
        // Address must be larger than the start address
        if (in6_addr_cmp(&network->first_address, address) > 0)
                return 0;
@@ -386,7 +386,7 @@ LOC_EXPORT int loc_network_set_country_code(struct loc_network* network, const c
        return 0;
 }
 
-LOC_EXPORT int loc_network_match_country_code(struct loc_network* network, const char* country_code) {
+LOC_EXPORT int loc_network_matches_country_code(struct loc_network* network, const char* country_code) {
        // Search for any special flags
        const int flag = loc_country_special_code_to_flag(country_code);
 
@@ -441,17 +441,17 @@ LOC_EXPORT int loc_network_cmp(struct loc_network* self, struct loc_network* oth
 
 LOC_EXPORT int loc_network_overlaps(struct loc_network* self, struct loc_network* other) {
        // Either of the start addresses must be in the other subnet
-       if (loc_network_match_address(self, &other->first_address))
+       if (loc_network_matches_address(self, &other->first_address))
                return 1;
 
-       if (loc_network_match_address(other, &self->first_address))
+       if (loc_network_matches_address(other, &self->first_address))
                return 1;
 
        // Or either of the end addresses is in the other subnet
-       if (loc_network_match_address(self, &other->last_address))
+       if (loc_network_matches_address(self, &other->last_address))
                return 1;
 
-       if (loc_network_match_address(other, &self->last_address))
+       if (loc_network_matches_address(other, &self->last_address))
                return 1;
 
        return 0;
index 6320c367063045c36b6baf2aa6b6408389a5bb34..c6aff49eb14f1c514adfa4091e85607352ed373a 100644 (file)
@@ -165,21 +165,21 @@ int main(int argc, char** argv) {
        loc_network_set_flag(network, LOC_NETWORK_FLAG_ANONYMOUS_PROXY);
 
        // Check if this network matches its own country code
-       err = loc_network_match_country_code(network, "YY");
+       err = loc_network_matches_country_code(network, "YY");
        if (!err) {
                fprintf(stderr, "Network does not match its own country code\n");
                exit(EXIT_FAILURE);
        }
 
        // Check if this network matches the special country code
-       err = loc_network_match_country_code(network, "A1");
+       err = loc_network_matches_country_code(network, "A1");
        if (!err) {
                fprintf(stderr, "Network does not match the special country code A1\n");
                exit(EXIT_FAILURE);
        }
 
        // Check if this network does not match another special country code
-       err = loc_network_match_country_code(network, "A2");
+       err = loc_network_matches_country_code(network, "A2");
        if (err) {
                fprintf(stderr, "Network matches another special country code A2\n");
                exit(EXIT_FAILURE);
index 2a577c6ae260b3af53956cf997ffb396d38fcdbd..4582fbe60bda7d27a55f7c358e8ef8f608b7ddec 100644 (file)
@@ -100,7 +100,7 @@ int main(int argc, char** argv) {
                exit(EXIT_FAILURE);
        }
 
-       err = loc_network_match_address(network1, &address);
+       err = loc_network_matches_address(network1, &address);
        if (!err) {
                fprintf(stderr, "Network1 does not match address\n");
                exit(EXIT_FAILURE);