Skip to content

Commit e64dc07

Browse files
committed
assert(a && b); -> assert(a); assert(b);
1 parent 04726f2 commit e64dc07

File tree

2 files changed

+44
-29
lines changed

2 files changed

+44
-29
lines changed

mysys/my_bitmap.c

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit)
255255
my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit)
256256
{
257257
my_bool res;
258-
DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
258+
DBUG_ASSERT(map->bitmap);
259+
DBUG_ASSERT(bitmap_bit < map->n_bits);
259260
bitmap_lock(map);
260261
res= bitmap_fast_test_and_set(map, bitmap_bit);
261262
bitmap_unlock(map);
@@ -288,7 +289,8 @@ my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
288289
my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
289290
{
290291
my_bool res;
291-
DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
292+
DBUG_ASSERT(map->bitmap);
293+
DBUG_ASSERT(bitmap_bit < map->n_bits);
292294
bitmap_lock(map);
293295
res= bitmap_fast_test_and_clear(map, bitmap_bit);
294296
bitmap_unlock(map);
@@ -317,8 +319,8 @@ void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size)
317319
uint prefix_bytes, prefix_bits, d;
318320
uchar *m= (uchar *)map->bitmap;
319321

320-
DBUG_ASSERT(map->bitmap &&
321-
(prefix_size <= map->n_bits || prefix_size == (uint) ~0));
322+
DBUG_ASSERT(map->bitmap);
323+
DBUG_ASSERT(prefix_size <= map->n_bits || prefix_size == (uint) ~0);
322324
set_if_smaller(prefix_size, map->n_bits);
323325
if ((prefix_bytes= prefix_size / 8))
324326
memset(m, 0xff, prefix_bytes);
@@ -340,7 +342,8 @@ my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
340342
uchar *m= (uchar*) map->bitmap;
341343
uchar *end_prefix= m+(prefix_size-1)/8;
342344
uchar *end;
343-
DBUG_ASSERT(m && prefix_size <= map->n_bits);
345+
DBUG_ASSERT(m);
346+
DBUG_ASSERT(prefix_size <= map->n_bits);
344347

345348
/* Empty prefix is always true */
346349
if (!prefix_size)
@@ -393,8 +396,8 @@ my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
393396
{
394397
my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
395398

396-
DBUG_ASSERT(map1->bitmap && map2->bitmap &&
397-
map1->n_bits==map2->n_bits);
399+
DBUG_ASSERT(map1->bitmap && map2->bitmap);
400+
DBUG_ASSERT(map1->n_bits==map2->n_bits);
398401

399402
end= map1->last_word_ptr;
400403
while (m1 < end)
@@ -412,8 +415,9 @@ my_bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2)
412415
{
413416
my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
414417

415-
DBUG_ASSERT(map1->bitmap && map2->bitmap &&
416-
map1->n_bits==map2->n_bits);
418+
DBUG_ASSERT(map1->bitmap);
419+
DBUG_ASSERT(map2->bitmap);
420+
DBUG_ASSERT(map1->n_bits==map2->n_bits);
417421

418422
end= map1->last_word_ptr;
419423
while (m1 < end)
@@ -431,7 +435,8 @@ void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
431435
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
432436
uint len= no_words_in_map(map), len2 = no_words_in_map(map2);
433437

434-
DBUG_ASSERT(map->bitmap && map2->bitmap);
438+
DBUG_ASSERT(map->bitmap);
439+
DBUG_ASSERT(map2->bitmap);
435440

436441
end= to+MY_MIN(len,len2);
437442
while (to < end)
@@ -476,7 +481,8 @@ my_bool bitmap_exists_intersection(const MY_BITMAP **bitmap_array,
476481
uint i, j, start_idx, end_idx;
477482
my_bitmap_map cur_res;
478483

479-
DBUG_ASSERT(bitmap_count && end_bit >= start_bit);
484+
DBUG_ASSERT(bitmap_count);
485+
DBUG_ASSERT(end_bit >= start_bit);
480486
for (j= 0; j < bitmap_count; j++)
481487
DBUG_ASSERT(end_bit < bitmap_array[j]->n_bits);
482488

@@ -504,8 +510,9 @@ my_bool bitmap_union_is_set_all(const MY_BITMAP *map1, const MY_BITMAP *map2)
504510
{
505511
my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
506512

507-
DBUG_ASSERT(map1->bitmap && map2->bitmap &&
508-
map1->n_bits==map2->n_bits);
513+
DBUG_ASSERT(map1->bitmap);
514+
DBUG_ASSERT(map2->bitmap);
515+
DBUG_ASSERT(map1->n_bits==map2->n_bits);
509516
end= map1->last_word_ptr;
510517
while ( m1 < end)
511518
if ((*m1++ | *m2++) != 0xFFFFFFFF)
@@ -550,8 +557,9 @@ void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit)
550557
void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
551558
{
552559
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
553-
DBUG_ASSERT(map->bitmap && map2->bitmap &&
554-
map->n_bits==map2->n_bits);
560+
DBUG_ASSERT(map->bitmap);
561+
DBUG_ASSERT(map2->bitmap);
562+
DBUG_ASSERT(map->n_bits==map2->n_bits);
555563

556564
end= map->last_word_ptr;
557565

@@ -564,8 +572,9 @@ void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
564572
{
565573
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
566574

567-
DBUG_ASSERT(map->bitmap && map2->bitmap &&
568-
map->n_bits==map2->n_bits);
575+
DBUG_ASSERT(map->bitmap);
576+
DBUG_ASSERT(map2->bitmap);
577+
DBUG_ASSERT(map->n_bits == map2->n_bits);
569578
end= map->last_word_ptr;
570579

571580
while (to <= end)
@@ -576,8 +585,9 @@ void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
576585
void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2)
577586
{
578587
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end= map->last_word_ptr;
579-
DBUG_ASSERT(map->bitmap && map2->bitmap &&
580-
map->n_bits==map2->n_bits);
588+
DBUG_ASSERT(map->bitmap);
589+
DBUG_ASSERT(map2->bitmap);
590+
DBUG_ASSERT(map->n_bits == map2->n_bits);
581591
while (to <= end)
582592
*to++ ^= *from++;
583593
}
@@ -614,8 +624,9 @@ void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2)
614624
{
615625
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
616626

617-
DBUG_ASSERT(map->bitmap && map2->bitmap &&
618-
map->n_bits==map2->n_bits);
627+
DBUG_ASSERT(map->bitmap);
628+
DBUG_ASSERT(map2->bitmap);
629+
DBUG_ASSERT(map->n_bits == map2->n_bits);
619630
end= map->last_word_ptr;
620631

621632
while (to <= end)
@@ -744,7 +755,8 @@ uint bitmap_lock_set_next(MY_BITMAP *map)
744755
void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit)
745756
{
746757
bitmap_lock(map);
747-
DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits);
758+
DBUG_ASSERT(map->bitmap);
759+
DBUG_ASSERT(bitmap_bit < map->n_bits);
748760
bitmap_clear_bit(map, bitmap_bit);
749761
bitmap_unlock(map);
750762
}

sql/ha_partition.cc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,7 +2183,8 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info)
21832183
sub_elem= subpart_it++;
21842184
DBUG_ASSERT(sub_elem);
21852185
part= i * num_subparts + j;
2186-
DBUG_ASSERT(part < m_file_tot_parts && m_file[part]);
2186+
DBUG_ASSERT(part < m_file_tot_parts);
2187+
DBUG_ASSERT(m_file[part]);
21872188
dummy_info.data_file_name= dummy_info.index_file_name = NULL;
21882189
m_file[part]->update_create_info(&dummy_info);
21892190
sub_elem->data_file_name = (char*) dummy_info.data_file_name;
@@ -3770,7 +3771,8 @@ int ha_partition::external_lock(THD *thd, int lock_type)
37703771
MY_BITMAP *used_partitions;
37713772
DBUG_ENTER("ha_partition::external_lock");
37723773

3773-
DBUG_ASSERT(!auto_increment_lock && !auto_increment_safe_stmt_log_lock);
3774+
DBUG_ASSERT(!auto_increment_lock);
3775+
DBUG_ASSERT(!auto_increment_safe_stmt_log_lock);
37743776

37753777
if (lock_type == F_UNLCK)
37763778
used_partitions= &m_locked_partitions;
@@ -4034,8 +4036,8 @@ void ha_partition::unlock_row()
40344036
bool ha_partition::was_semi_consistent_read()
40354037
{
40364038
DBUG_ENTER("ha_partition::was_semi_consistent_read");
4037-
DBUG_ASSERT(m_last_part < m_tot_parts &&
4038-
bitmap_is_set(&(m_part_info->read_partitions), m_last_part));
4039+
DBUG_ASSERT(m_last_part < m_tot_parts);
4040+
DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), m_last_part));
40394041
DBUG_RETURN(m_file[m_last_part]->was_semi_consistent_read());
40404042
}
40414043

@@ -5910,8 +5912,8 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag)
59105912
DBUG_ASSERT(m_part_spec.start_part < m_tot_parts);
59115913
m_ordered_scan_ongoing= m_ordered;
59125914
}
5913-
DBUG_ASSERT(m_part_spec.start_part < m_tot_parts &&
5914-
m_part_spec.end_part < m_tot_parts);
5915+
DBUG_ASSERT(m_part_spec.start_part < m_tot_parts);
5916+
DBUG_ASSERT(m_part_spec.end_part < m_tot_parts);
59155917
DBUG_RETURN(0);
59165918
}
59175919

@@ -8653,7 +8655,8 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment,
86538655
DBUG_PRINT("info", ("offset: %lu inc: %lu desired_values: %lu "
86548656
"first_value: %lu", (ulong) offset, (ulong) increment,
86558657
(ulong) nb_desired_values, (ulong) *first_value));
8656-
DBUG_ASSERT(increment && nb_desired_values);
8658+
DBUG_ASSERT(increment);
8659+
DBUG_ASSERT(nb_desired_values);
86578660
*first_value= 0;
86588661
if (table->s->next_number_keypart)
86598662
{

0 commit comments

Comments
 (0)