Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Jun 4, 2024
1 parent 97147f4 commit 1b5fec6
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/roaring64.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static inline uint64_t minimum(uint64_t a, uint64_t b) {

static inline leaf_t *create_leaf(container_t *container, uint8_t typecode) {
leaf_t *leaf = (leaf_t *)roaring_malloc(sizeof(leaf_t));
if(leaf == NULL) {
if (leaf == NULL) {
return NULL;
}
leaf->container = container;
Expand All @@ -89,7 +89,7 @@ static inline leaf_t *create_leaf(container_t *container, uint8_t typecode) {

static inline leaf_t *copy_leaf_container(const leaf_t *leaf) {
leaf_t *result_leaf = (leaf_t *)roaring_malloc(sizeof(leaf_t));
if(result_leaf == NULL) {
if (result_leaf == NULL) {
return NULL;
}
result_leaf->typecode = leaf->typecode;
Expand Down Expand Up @@ -148,7 +148,7 @@ static inline roaring64_iterator_t *roaring64_iterator_init_at(
roaring64_bitmap_t *roaring64_bitmap_create(void) {
roaring64_bitmap_t *r =
(roaring64_bitmap_t *)roaring_malloc(sizeof(roaring64_bitmap_t));
if(r == NULL) {
if (r == NULL) {
return NULL;
}
r->art.root = NULL;
Expand Down Expand Up @@ -200,7 +200,7 @@ roaring64_bitmap_t *roaring64_bitmap_from_range(uint64_t min, uint64_t max,
return NULL;
}
roaring64_bitmap_t *r = roaring64_bitmap_create();
if(r == NULL) {
if (r == NULL) {
return NULL;
}
if (step >= (1 << 16)) {
Expand Down Expand Up @@ -240,7 +240,7 @@ roaring64_bitmap_t *roaring64_bitmap_from_range(uint64_t min, uint64_t max,
roaring64_bitmap_t *roaring64_bitmap_of_ptr(size_t n_args,
const uint64_t *vals) {
roaring64_bitmap_t *r = roaring64_bitmap_create();
if(r == NULL) {
if (r == NULL) {
return NULL;
}
roaring64_bitmap_add_many(r, n_args, vals);
Expand All @@ -249,7 +249,7 @@ roaring64_bitmap_t *roaring64_bitmap_of_ptr(size_t n_args,

roaring64_bitmap_t *roaring64_bitmap_of(size_t n_args, ...) {
roaring64_bitmap_t *r = roaring64_bitmap_create();
if(r == NULL) {
if (r == NULL) {
return NULL;
}
roaring64_bulk_context_t context = {0, 0, 0, 0, 0, 0, 0};
Expand Down Expand Up @@ -964,7 +964,7 @@ bool roaring64_bitmap_is_strict_subset(const roaring64_bitmap_t *r1,
roaring64_bitmap_t *roaring64_bitmap_and(const roaring64_bitmap_t *r1,
const roaring64_bitmap_t *r2) {
roaring64_bitmap_t *result = roaring64_bitmap_create();
if(result == NULL) {
if (result == NULL) {
return NULL;
}

Expand All @@ -980,7 +980,7 @@ roaring64_bitmap_t *roaring64_bitmap_and(const roaring64_bitmap_t *r1,
if (compare_result == 0) {
// Case 2: iterators at the same high key position.
leaf_t *result_leaf = (leaf_t *)roaring_malloc(sizeof(leaf_t));
if(result_leaf == NULL) {
if (result_leaf == NULL) {
roaring64_bitmap_free(result);
return NULL;
}
Expand Down Expand Up @@ -1173,7 +1173,7 @@ double roaring64_bitmap_jaccard_index(const roaring64_bitmap_t *r1,
roaring64_bitmap_t *roaring64_bitmap_or(const roaring64_bitmap_t *r1,
const roaring64_bitmap_t *r2) {
roaring64_bitmap_t *result = roaring64_bitmap_create();
if(result == NULL) {
if (result == NULL) {
return NULL;
}

Expand All @@ -1199,7 +1199,7 @@ roaring64_bitmap_t *roaring64_bitmap_or(const roaring64_bitmap_t *r1,
leaf_t *leaf1 = (leaf_t *)it1.value;
leaf_t *leaf2 = (leaf_t *)it2.value;
leaf_t *result_leaf = (leaf_t *)roaring_malloc(sizeof(leaf_t));
if(result_leaf == NULL) {
if (result_leaf == NULL) {
roaring64_bitmap_free(result);
return NULL;
}
Expand All @@ -1214,7 +1214,7 @@ roaring64_bitmap_t *roaring64_bitmap_or(const roaring64_bitmap_t *r1,
if ((it1_present && !it2_present) || compare_result < 0) {
// Cases 1 and 3a: it1 is the only iterator or is before it2.
leaf_t *result_leaf = copy_leaf_container((leaf_t *)it1.value);
if(result_leaf == NULL) {
if (result_leaf == NULL) {
roaring64_bitmap_free(result);
return NULL;
}
Expand All @@ -1223,7 +1223,7 @@ roaring64_bitmap_t *roaring64_bitmap_or(const roaring64_bitmap_t *r1,
} else if ((!it1_present && it2_present) || compare_result > 0) {
// Cases 2 and 3c: it2 is the only iterator or is before it1.
leaf_t *result_leaf = copy_leaf_container((leaf_t *)it2.value);
if(result_leaf == NULL) {
if (result_leaf == NULL) {
roaring64_bitmap_free(result);
return NULL;
}
Expand Down Expand Up @@ -1294,7 +1294,7 @@ void roaring64_bitmap_or_inplace(roaring64_bitmap_t *r1,
} else if ((!it1_present && it2_present) || compare_result > 0) {
// Cases 2 and 3c: it2 is the only iterator or is before it1.
leaf_t *result_leaf = copy_leaf_container((leaf_t *)it2.value);
if(result_leaf == NULL) {
if (result_leaf == NULL) {
return;
}
art_iterator_insert(&r1->art, &it1, it2.key,
Expand All @@ -1307,7 +1307,7 @@ void roaring64_bitmap_or_inplace(roaring64_bitmap_t *r1,
roaring64_bitmap_t *roaring64_bitmap_xor(const roaring64_bitmap_t *r1,
const roaring64_bitmap_t *r2) {
roaring64_bitmap_t *result = roaring64_bitmap_create();
if(result == NULL) {
if (result == NULL) {
return NULL;
}

Expand All @@ -1333,7 +1333,7 @@ roaring64_bitmap_t *roaring64_bitmap_xor(const roaring64_bitmap_t *r1,
leaf_t *leaf1 = (leaf_t *)it1.value;
leaf_t *leaf2 = (leaf_t *)it2.value;
leaf_t *result_leaf = (leaf_t *)roaring_malloc(sizeof(leaf_t));
if(result_leaf == NULL) {
if (result_leaf == NULL) {
roaring64_bitmap_free(result);
return NULL;
}
Expand All @@ -1355,7 +1355,7 @@ roaring64_bitmap_t *roaring64_bitmap_xor(const roaring64_bitmap_t *r1,
if ((it1_present && !it2_present) || compare_result < 0) {
// Cases 1 and 3a: it1 is the only iterator or is before it2.
leaf_t *result_leaf = copy_leaf_container((leaf_t *)it1.value);
if(result_leaf == NULL) {
if (result_leaf == NULL) {
roaring64_bitmap_free(result);
return NULL;
}
Expand All @@ -1364,7 +1364,7 @@ roaring64_bitmap_t *roaring64_bitmap_xor(const roaring64_bitmap_t *r1,
} else if ((!it1_present && it2_present) || compare_result > 0) {
// Cases 2 and 3c: it2 is the only iterator or is before it1.
leaf_t *result_leaf = copy_leaf_container((leaf_t *)it2.value);
if(result_leaf == NULL) {
if (result_leaf == NULL) {
roaring64_bitmap_free(result);
return NULL;
}
Expand Down Expand Up @@ -1447,7 +1447,7 @@ void roaring64_bitmap_xor_inplace(roaring64_bitmap_t *r1,
} else if ((!it1_present && it2_present) || compare_result > 0) {
// Cases 2 and 3c: it2 is the only iterator or is before it1.
leaf_t *result_leaf = copy_leaf_container((leaf_t *)it2.value);
if(result_leaf == NULL) {
if (result_leaf == NULL) {
return;
}
if (it1_present) {
Expand All @@ -1465,7 +1465,7 @@ void roaring64_bitmap_xor_inplace(roaring64_bitmap_t *r1,
roaring64_bitmap_t *roaring64_bitmap_andnot(const roaring64_bitmap_t *r1,
const roaring64_bitmap_t *r2) {
roaring64_bitmap_t *result = roaring64_bitmap_create();
if(result == NULL) {
if (result == NULL) {
return NULL;
}

Expand All @@ -1486,7 +1486,7 @@ roaring64_bitmap_t *roaring64_bitmap_andnot(const roaring64_bitmap_t *r1,
if (compare_result == 0) {
// Case 2b: iterators at the same high key position.
leaf_t *result_leaf = (leaf_t *)roaring_malloc(sizeof(leaf_t));
if(result_leaf == NULL) {
if (result_leaf == NULL) {
roaring64_bitmap_free(result);
return NULL;
}
Expand All @@ -1511,7 +1511,7 @@ roaring64_bitmap_t *roaring64_bitmap_andnot(const roaring64_bitmap_t *r1,
if (!it2_present || compare_result < 0) {
// Cases 1 and 2a: it1 is the only iterator or is before it2.
leaf_t *result_leaf = copy_leaf_container((leaf_t *)it1.value);
if(result_leaf == NULL) {
if (result_leaf == NULL) {
roaring64_bitmap_free(result);
return NULL;
}
Expand Down Expand Up @@ -1687,7 +1687,7 @@ roaring64_bitmap_t *roaring64_bitmap_flip_closed(const roaring64_bitmap_t *r1,
uint64_t max_high48_bits = (max & 0xFFFFFFFFFFFF0000ULL) >> 16;

roaring64_bitmap_t *r2 = roaring64_bitmap_create();
if(r2 == NULL) {
if (r2 == NULL) {
return NULL;
}
art_iterator_t it = art_init_iterator(&r1->art, /*first=*/true);
Expand All @@ -1698,7 +1698,7 @@ roaring64_bitmap_t *roaring64_bitmap_flip_closed(const roaring64_bitmap_t *r1,
uint8_t typecode2 = leaf1->typecode;
container_t *container2 = get_copy_of_container(
leaf1->container, &typecode2, /*copy_on_write=*/false);
if(container2 == NULL) {
if (container2 == NULL) {
roaring64_bitmap_free(r2);
return NULL;
}
Expand Down Expand Up @@ -1736,7 +1736,7 @@ roaring64_bitmap_t *roaring64_bitmap_flip_closed(const roaring64_bitmap_t *r1,
uint8_t typecode2 = leaf1->typecode;
container_t *container2 = get_copy_of_container(
leaf1->container, &typecode2, /*copy_on_write=*/false);
if(container2 == NULL) {
if (container2 == NULL) {
roaring64_bitmap_free(r2);
return NULL;
}
Expand Down Expand Up @@ -2006,7 +2006,7 @@ roaring64_bitmap_t *roaring64_bitmap_portable_deserialize_safe(
}

roaring64_bitmap_t *r = roaring64_bitmap_create();
if(r == NULL) {
if (r == NULL) {
return NULL;
}
// Iterate through buckets ordered by increasing keys.
Expand Down Expand Up @@ -2087,7 +2087,7 @@ void roaring64_bitmap_to_uint64_array(const roaring64_bitmap_t *r,
roaring64_iterator_t *roaring64_iterator_create(const roaring64_bitmap_t *r) {
roaring64_iterator_t *it =
(roaring64_iterator_t *)roaring_malloc(sizeof(roaring64_iterator_t));
if(it == NULL) {
if (it == NULL) {
return NULL;
}
return roaring64_iterator_init_at(r, it, /*first=*/true);
Expand All @@ -2097,7 +2097,7 @@ roaring64_iterator_t *roaring64_iterator_create_last(
const roaring64_bitmap_t *r) {
roaring64_iterator_t *it =
(roaring64_iterator_t *)roaring_malloc(sizeof(roaring64_iterator_t));
if(it == NULL) {
if (it == NULL) {
return NULL;
}
return roaring64_iterator_init_at(r, it, /*first=*/false);
Expand All @@ -2116,7 +2116,7 @@ void roaring64_iterator_reinit_last(const roaring64_bitmap_t *r,
roaring64_iterator_t *roaring64_iterator_copy(const roaring64_iterator_t *it) {
roaring64_iterator_t *new_it =
(roaring64_iterator_t *)roaring_malloc(sizeof(roaring64_iterator_t));
if(new_it == NULL) {
if (new_it == NULL) {
return NULL;
}
memcpy(new_it, it, sizeof(*it));
Expand Down

0 comments on commit 1b5fec6

Please sign in to comment.