Commit e64dc071 authored by Sergei Golubchik's avatar Sergei Golubchik

assert(a && b); -> assert(a); assert(b);

parent 04726f29
...@@ -255,7 +255,8 @@ my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit) ...@@ -255,7 +255,8 @@ my_bool bitmap_fast_test_and_set(MY_BITMAP *map, uint bitmap_bit)
my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit) my_bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit)
{ {
my_bool res; my_bool res;
DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits); DBUG_ASSERT(map->bitmap);
DBUG_ASSERT(bitmap_bit < map->n_bits);
bitmap_lock(map); bitmap_lock(map);
res= bitmap_fast_test_and_set(map, bitmap_bit); res= bitmap_fast_test_and_set(map, bitmap_bit);
bitmap_unlock(map); bitmap_unlock(map);
...@@ -288,7 +289,8 @@ my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit) ...@@ -288,7 +289,8 @@ my_bool bitmap_fast_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit) my_bool bitmap_test_and_clear(MY_BITMAP *map, uint bitmap_bit)
{ {
my_bool res; my_bool res;
DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits); DBUG_ASSERT(map->bitmap);
DBUG_ASSERT(bitmap_bit < map->n_bits);
bitmap_lock(map); bitmap_lock(map);
res= bitmap_fast_test_and_clear(map, bitmap_bit); res= bitmap_fast_test_and_clear(map, bitmap_bit);
bitmap_unlock(map); bitmap_unlock(map);
...@@ -317,8 +319,8 @@ void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size) ...@@ -317,8 +319,8 @@ void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size)
uint prefix_bytes, prefix_bits, d; uint prefix_bytes, prefix_bits, d;
uchar *m= (uchar *)map->bitmap; uchar *m= (uchar *)map->bitmap;
DBUG_ASSERT(map->bitmap && DBUG_ASSERT(map->bitmap);
(prefix_size <= map->n_bits || prefix_size == (uint) ~0)); DBUG_ASSERT(prefix_size <= map->n_bits || prefix_size == (uint) ~0);
set_if_smaller(prefix_size, map->n_bits); set_if_smaller(prefix_size, map->n_bits);
if ((prefix_bytes= prefix_size / 8)) if ((prefix_bytes= prefix_size / 8))
memset(m, 0xff, prefix_bytes); memset(m, 0xff, prefix_bytes);
...@@ -340,7 +342,8 @@ my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size) ...@@ -340,7 +342,8 @@ my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
uchar *m= (uchar*) map->bitmap; uchar *m= (uchar*) map->bitmap;
uchar *end_prefix= m+(prefix_size-1)/8; uchar *end_prefix= m+(prefix_size-1)/8;
uchar *end; uchar *end;
DBUG_ASSERT(m && prefix_size <= map->n_bits); DBUG_ASSERT(m);
DBUG_ASSERT(prefix_size <= map->n_bits);
/* Empty prefix is always true */ /* Empty prefix is always true */
if (!prefix_size) if (!prefix_size)
...@@ -393,8 +396,8 @@ my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2) ...@@ -393,8 +396,8 @@ my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
{ {
my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end; my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
DBUG_ASSERT(map1->bitmap && map2->bitmap && DBUG_ASSERT(map1->bitmap && map2->bitmap);
map1->n_bits==map2->n_bits); DBUG_ASSERT(map1->n_bits==map2->n_bits);
end= map1->last_word_ptr; end= map1->last_word_ptr;
while (m1 < end) while (m1 < end)
...@@ -412,8 +415,9 @@ my_bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2) ...@@ -412,8 +415,9 @@ my_bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2)
{ {
my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end; my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
DBUG_ASSERT(map1->bitmap && map2->bitmap && DBUG_ASSERT(map1->bitmap);
map1->n_bits==map2->n_bits); DBUG_ASSERT(map2->bitmap);
DBUG_ASSERT(map1->n_bits==map2->n_bits);
end= map1->last_word_ptr; end= map1->last_word_ptr;
while (m1 < end) while (m1 < end)
...@@ -431,7 +435,8 @@ void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2) ...@@ -431,7 +435,8 @@ void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end; my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
uint len= no_words_in_map(map), len2 = no_words_in_map(map2); uint len= no_words_in_map(map), len2 = no_words_in_map(map2);
DBUG_ASSERT(map->bitmap && map2->bitmap); DBUG_ASSERT(map->bitmap);
DBUG_ASSERT(map2->bitmap);
end= to+MY_MIN(len,len2); end= to+MY_MIN(len,len2);
while (to < end) while (to < end)
...@@ -476,7 +481,8 @@ my_bool bitmap_exists_intersection(const MY_BITMAP **bitmap_array, ...@@ -476,7 +481,8 @@ my_bool bitmap_exists_intersection(const MY_BITMAP **bitmap_array,
uint i, j, start_idx, end_idx; uint i, j, start_idx, end_idx;
my_bitmap_map cur_res; my_bitmap_map cur_res;
DBUG_ASSERT(bitmap_count && end_bit >= start_bit); DBUG_ASSERT(bitmap_count);
DBUG_ASSERT(end_bit >= start_bit);
for (j= 0; j < bitmap_count; j++) for (j= 0; j < bitmap_count; j++)
DBUG_ASSERT(end_bit < bitmap_array[j]->n_bits); DBUG_ASSERT(end_bit < bitmap_array[j]->n_bits);
...@@ -504,8 +510,9 @@ my_bool bitmap_union_is_set_all(const MY_BITMAP *map1, const MY_BITMAP *map2) ...@@ -504,8 +510,9 @@ my_bool bitmap_union_is_set_all(const MY_BITMAP *map1, const MY_BITMAP *map2)
{ {
my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end; my_bitmap_map *m1= map1->bitmap, *m2= map2->bitmap, *end;
DBUG_ASSERT(map1->bitmap && map2->bitmap && DBUG_ASSERT(map1->bitmap);
map1->n_bits==map2->n_bits); DBUG_ASSERT(map2->bitmap);
DBUG_ASSERT(map1->n_bits==map2->n_bits);
end= map1->last_word_ptr; end= map1->last_word_ptr;
while ( m1 < end) while ( m1 < end)
if ((*m1++ | *m2++) != 0xFFFFFFFF) if ((*m1++ | *m2++) != 0xFFFFFFFF)
...@@ -550,8 +557,9 @@ void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit) ...@@ -550,8 +557,9 @@ void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit)
void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2) void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
{ {
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end; my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
DBUG_ASSERT(map->bitmap && map2->bitmap && DBUG_ASSERT(map->bitmap);
map->n_bits==map2->n_bits); DBUG_ASSERT(map2->bitmap);
DBUG_ASSERT(map->n_bits==map2->n_bits);
end= map->last_word_ptr; end= map->last_word_ptr;
...@@ -564,8 +572,9 @@ void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2) ...@@ -564,8 +572,9 @@ void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
{ {
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end; my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
DBUG_ASSERT(map->bitmap && map2->bitmap && DBUG_ASSERT(map->bitmap);
map->n_bits==map2->n_bits); DBUG_ASSERT(map2->bitmap);
DBUG_ASSERT(map->n_bits == map2->n_bits);
end= map->last_word_ptr; end= map->last_word_ptr;
while (to <= end) while (to <= end)
...@@ -576,8 +585,9 @@ void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2) ...@@ -576,8 +585,9 @@ void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2) void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2)
{ {
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end= map->last_word_ptr; my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end= map->last_word_ptr;
DBUG_ASSERT(map->bitmap && map2->bitmap && DBUG_ASSERT(map->bitmap);
map->n_bits==map2->n_bits); DBUG_ASSERT(map2->bitmap);
DBUG_ASSERT(map->n_bits == map2->n_bits);
while (to <= end) while (to <= end)
*to++ ^= *from++; *to++ ^= *from++;
} }
...@@ -614,8 +624,9 @@ void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2) ...@@ -614,8 +624,9 @@ void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2)
{ {
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end; my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
DBUG_ASSERT(map->bitmap && map2->bitmap && DBUG_ASSERT(map->bitmap);
map->n_bits==map2->n_bits); DBUG_ASSERT(map2->bitmap);
DBUG_ASSERT(map->n_bits == map2->n_bits);
end= map->last_word_ptr; end= map->last_word_ptr;
while (to <= end) while (to <= end)
...@@ -744,7 +755,8 @@ uint bitmap_lock_set_next(MY_BITMAP *map) ...@@ -744,7 +755,8 @@ uint bitmap_lock_set_next(MY_BITMAP *map)
void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit) void bitmap_lock_clear_bit(MY_BITMAP *map, uint bitmap_bit)
{ {
bitmap_lock(map); bitmap_lock(map);
DBUG_ASSERT(map->bitmap && bitmap_bit < map->n_bits); DBUG_ASSERT(map->bitmap);
DBUG_ASSERT(bitmap_bit < map->n_bits);
bitmap_clear_bit(map, bitmap_bit); bitmap_clear_bit(map, bitmap_bit);
bitmap_unlock(map); bitmap_unlock(map);
} }
......
...@@ -2183,7 +2183,8 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info) ...@@ -2183,7 +2183,8 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info)
sub_elem= subpart_it++; sub_elem= subpart_it++;
DBUG_ASSERT(sub_elem); DBUG_ASSERT(sub_elem);
part= i * num_subparts + j; part= i * num_subparts + j;
DBUG_ASSERT(part < m_file_tot_parts && m_file[part]); DBUG_ASSERT(part < m_file_tot_parts);
DBUG_ASSERT(m_file[part]);
dummy_info.data_file_name= dummy_info.index_file_name = NULL; dummy_info.data_file_name= dummy_info.index_file_name = NULL;
m_file[part]->update_create_info(&dummy_info); m_file[part]->update_create_info(&dummy_info);
sub_elem->data_file_name = (char*) dummy_info.data_file_name; 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) ...@@ -3770,7 +3771,8 @@ int ha_partition::external_lock(THD *thd, int lock_type)
MY_BITMAP *used_partitions; MY_BITMAP *used_partitions;
DBUG_ENTER("ha_partition::external_lock"); DBUG_ENTER("ha_partition::external_lock");
DBUG_ASSERT(!auto_increment_lock && !auto_increment_safe_stmt_log_lock); DBUG_ASSERT(!auto_increment_lock);
DBUG_ASSERT(!auto_increment_safe_stmt_log_lock);
if (lock_type == F_UNLCK) if (lock_type == F_UNLCK)
used_partitions= &m_locked_partitions; used_partitions= &m_locked_partitions;
...@@ -4034,8 +4036,8 @@ void ha_partition::unlock_row() ...@@ -4034,8 +4036,8 @@ void ha_partition::unlock_row()
bool ha_partition::was_semi_consistent_read() bool ha_partition::was_semi_consistent_read()
{ {
DBUG_ENTER("ha_partition::was_semi_consistent_read"); DBUG_ENTER("ha_partition::was_semi_consistent_read");
DBUG_ASSERT(m_last_part < m_tot_parts && DBUG_ASSERT(m_last_part < m_tot_parts);
bitmap_is_set(&(m_part_info->read_partitions), m_last_part)); DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), m_last_part));
DBUG_RETURN(m_file[m_last_part]->was_semi_consistent_read()); DBUG_RETURN(m_file[m_last_part]->was_semi_consistent_read());
} }
...@@ -5910,8 +5912,8 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag) ...@@ -5910,8 +5912,8 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag)
DBUG_ASSERT(m_part_spec.start_part < m_tot_parts); DBUG_ASSERT(m_part_spec.start_part < m_tot_parts);
m_ordered_scan_ongoing= m_ordered; m_ordered_scan_ongoing= m_ordered;
} }
DBUG_ASSERT(m_part_spec.start_part < m_tot_parts && DBUG_ASSERT(m_part_spec.start_part < m_tot_parts);
m_part_spec.end_part < m_tot_parts); DBUG_ASSERT(m_part_spec.end_part < m_tot_parts);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -8653,7 +8655,8 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment, ...@@ -8653,7 +8655,8 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment,
DBUG_PRINT("info", ("offset: %lu inc: %lu desired_values: %lu " DBUG_PRINT("info", ("offset: %lu inc: %lu desired_values: %lu "
"first_value: %lu", (ulong) offset, (ulong) increment, "first_value: %lu", (ulong) offset, (ulong) increment,
(ulong) nb_desired_values, (ulong) *first_value)); (ulong) nb_desired_values, (ulong) *first_value));
DBUG_ASSERT(increment && nb_desired_values); DBUG_ASSERT(increment);
DBUG_ASSERT(nb_desired_values);
*first_value= 0; *first_value= 0;
if (table->s->next_number_keypart) if (table->s->next_number_keypart)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment