]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
address: Rename in6_addr_get_bit/in6_addr_set_bit to loc_address_*
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 7 Mar 2022 11:54:26 +0000 (11:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 7 Mar 2022 11:54:26 +0000 (11:54 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.c
src/libloc/address.h
src/network.c

index 62d9a81baf9cb1ee198418492a63c89fecda1fe3..ff000a98192d6b92fd13935472a9b6ead5d2986e 100644 (file)
@@ -809,8 +809,8 @@ static int __loc_database_lookup(struct loc_database* db, const struct in6_addr*
        off_t node_index;
 
        // Follow the path
-       int bit = in6_addr_get_bit(address, level);
-       in6_addr_set_bit(network_address, level, bit);
+       int bit = loc_address_get_bit(address, level);
+       loc_address_set_bit(network_address, level, bit);
 
        if (bit == 0)
                node_index = be32toh(node->zero);
@@ -1243,7 +1243,7 @@ static int __loc_database_enumerator_next_network(
                }
 
                // Mark the bits on the path correctly
-               in6_addr_set_bit(&enumerator->network_address,
+               loc_address_set_bit(&enumerator->network_address,
                        (node->depth > 0) ? node->depth - 1 : 0, node->i);
 
                DEBUG(enumerator->ctx, "Looking at node %jd\n", (intmax_t)node->offset);
index 86a8b6188a20c8d3c9e983afdaefaa9fc75757e4..f40a4f4cc624407cd809a2e99a682cdd56ceed4f 100644 (file)
@@ -45,11 +45,11 @@ static inline int loc_address_cmp(const struct in6_addr* a1, const struct in6_ad
        return 0;
 }
 
-static inline int in6_addr_get_bit(const struct in6_addr* address, unsigned int i) {
+static inline int loc_address_get_bit(const struct in6_addr* address, unsigned int i) {
        return ((address->s6_addr[i / 8] >> (7 - (i % 8))) & 1);
 }
 
-static inline void in6_addr_set_bit(struct in6_addr* address, unsigned int i, unsigned int val) {
+static inline void loc_address_set_bit(struct in6_addr* address, unsigned int i, unsigned int val) {
        address->s6_addr[i / 8] ^= (-val ^ address->s6_addr[i / 8]) & (1 << (7 - (i % 8)));
 }
 
index 551d6972dfe33548f5e81cef257fb2d3856043eb..5135f1cbde5bcc8570326ea85737574163dc77fd 100644 (file)
@@ -782,7 +782,7 @@ static struct loc_network_tree_node* loc_network_tree_get_path(struct loc_networ
 
        for (unsigned int i = 0; i < prefix; i++) {
                // Check if the ith bit is one or zero
-               node = loc_network_tree_get_node(node, in6_addr_get_bit(address, i));
+               node = loc_network_tree_get_node(node, loc_address_get_bit(address, i));
        }
 
        return node;