diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2014-02-19 14:05:15 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2014-02-19 14:05:15 +0400 |
commit | d12c7adf715677b118104d4e5adf6f978c27b4ee (patch) | |
tree | 04cdbaf4509cbe485cb992e271ab8d711a867011 | |
parent | fd1437dfe532ed78ce2a1c8e05a989fcbf79832e (diff) | |
download | mariadb-git-d12c7adf715677b118104d4e5adf6f978c27b4ee.tar.gz |
MDEV-5314 - Compiling fails on OSX using clang
This is port of fix for MySQL BUG#17647863.
revno: 5572
revision-id: jon.hauglid@oracle.com-20131030232243-b0pw98oy72uka2sj
committer: Jon Olav Hauglid <jon.hauglid@oracle.com>
timestamp: Thu 2013-10-31 00:22:43 +0100
message:
Bug#17647863: MYSQL DOES NOT COMPILE ON OSX 10.9 GM
Rename test() macro to MY_TEST() to avoid conflict with libc++.
133 files changed, 600 insertions, 585 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index ebc8f551888..57b7ce09ab5 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -1047,7 +1047,7 @@ int main(int argc, char **argv) for (i = 0; i < alter_table_cmds.elements ; i++) run_query((char*) dynamic_array_ptr(&alter_table_cmds, i)); } - ret= test(first_error); + ret= MY_TEST(first_error); end: dbDisconnect(current_host); diff --git a/include/maria.h b/include/maria.h index 5812c543c1e..908825b9970 100644 --- a/include/maria.h +++ b/include/maria.h @@ -69,8 +69,8 @@ extern "C" { #if MARIA_MAX_KEY > MARIA_KEYMAP_BITS #define maria_is_key_active(_keymap_,_keyno_) \ (((_keyno_) < MARIA_KEYMAP_BITS) ? \ - test((_keymap_) & (1ULL << (_keyno_))) : \ - test((_keymap_) & MARIA_KEYMAP_HIGH_MASK)) + MY_TEST((_keymap_) & (1ULL << (_keyno_))) : \ + MY_TEST((_keymap_) & MARIA_KEYMAP_HIGH_MASK)) #define maria_set_key_active(_keymap_,_keyno_) \ (_keymap_)|= (((_keyno_) < MARIA_KEYMAP_BITS) ? \ (1ULL << (_keyno_)) : \ @@ -81,14 +81,14 @@ extern "C" { (~ (0ULL)) /*ignore*/ ) #else #define maria_is_key_active(_keymap_,_keyno_) \ - test((_keymap_) & (1ULL << (_keyno_))) + MY_TEST((_keymap_) & (1ULL << (_keyno_))) #define maria_set_key_active(_keymap_,_keyno_) \ (_keymap_)|= (1ULL << (_keyno_)) #define maria_clear_key_active(_keymap_,_keyno_) \ (_keymap_)&= (~ (1ULL << (_keyno_))) #endif #define maria_is_any_key_active(_keymap_) \ - test((_keymap_)) + MY_TEST((_keymap_)) #define maria_is_all_keys_active(_keymap_,_keys_) \ ((_keymap_) == maria_get_mask_all_keys_active(_keys_)) #define maria_set_all_keys_active(_keymap_,_keys_) \ diff --git a/include/my_global.h b/include/my_global.h index 927c1fcd893..55abb407872 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -474,7 +474,7 @@ typedef unsigned short ushort; #endif #define swap_variables(t, a, b) do { t dummy; dummy= a; a= b; b= dummy; } while(0) -#define test(a) ((a) ? 1 : 0) +#define MY_TEST(a) ((a) ? 1 : 0) #define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0) #define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0) #define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1)) diff --git a/include/my_time.h b/include/my_time.h index 67aa9a27f7f..cec1c66a97a 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -74,8 +74,8 @@ extern uchar days_in_month[]; #define MYSQL_TIME_WARN_WARNINGS (MYSQL_TIME_WARN_TRUNCATED|MYSQL_TIME_WARN_OUT_OF_RANGE) #define MYSQL_TIME_WARN_NOTES (MYSQL_TIME_NOTE_TRUNCATED) -#define MYSQL_TIME_WARN_HAVE_WARNINGS(x) test((x) & MYSQL_TIME_WARN_WARNINGS) -#define MYSQL_TIME_WARN_HAVE_NOTES(x) test((x) & MYSQL_TIME_WARN_NOTES) +#define MYSQL_TIME_WARN_HAVE_WARNINGS(x) MY_TEST((x) & MYSQL_TIME_WARN_WARNINGS) +#define MYSQL_TIME_WARN_HAVE_NOTES(x) MY_TEST((x) & MYSQL_TIME_WARN_NOTES) /* Limits for the TIME data type */ #define TIME_MAX_HOUR 838 diff --git a/include/myisam.h b/include/myisam.h index 218dd1877e8..d0dce5e2512 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -68,8 +68,8 @@ extern "C" { #define mi_is_key_active(_keymap_,_keyno_) \ (((_keyno_) < MI_KEYMAP_BITS) ? \ - test((_keymap_) & (1ULL << (_keyno_))) : \ - test((_keymap_) & MI_KEYMAP_HIGH_MASK)) + MY_TEST((_keymap_) & (1ULL << (_keyno_))) : \ + MY_TEST((_keymap_) & MI_KEYMAP_HIGH_MASK)) #define mi_set_key_active(_keymap_,_keyno_) \ (_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \ (1ULL << (_keyno_)) : \ @@ -82,7 +82,7 @@ extern "C" { #else #define mi_is_key_active(_keymap_,_keyno_) \ - test((_keymap_) & (1ULL << (_keyno_))) + MY_TEST((_keymap_) & (1ULL << (_keyno_))) #define mi_set_key_active(_keymap_,_keyno_) \ (_keymap_)|= (1ULL << (_keyno_)) #define mi_clear_key_active(_keymap_,_keyno_) \ @@ -91,7 +91,7 @@ extern "C" { #endif #define mi_is_any_key_active(_keymap_) \ - test((_keymap_)) + MY_TEST((_keymap_)) #define mi_is_all_keys_active(_keymap_,_keys_) \ ((_keymap_) == mi_get_mask_all_keys_active(_keys_)) #define mi_set_all_keys_active(_keymap_,_keys_) \ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 78de4b8867f..66720e9d510 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2083,8 +2083,8 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) buff[4]= (char) stmt->flags; int4store(buff+5, 1); /* iteration count */ - res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), - (uchar*) packet, length, 1, stmt) || + res= MY_TEST(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), + (uchar*) packet, length, 1, stmt) || (*mysql->methods->read_query_result)(mysql)); stmt->affected_rows= mysql->affected_rows; stmt->server_status= mysql->server_status; @@ -2571,7 +2571,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt) reinit_result_set_metadata(stmt); prepare_to_fetch_result(stmt); } - DBUG_RETURN(test(stmt->last_errno)); + DBUG_RETURN(MY_TEST(stmt->last_errno)); } @@ -3187,14 +3187,14 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, { double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err); float fdata= (float) data; - *param->error= (fdata != data) | test(err); + *param->error= (fdata != data) | MY_TEST(err); floatstore(buffer, fdata); break; } case MYSQL_TYPE_DOUBLE: { double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err); - *param->error= test(err); + *param->error= MY_TEST(err); doublestore(buffer, data); break; } @@ -3204,7 +3204,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, MYSQL_TIME_STATUS status; str_to_time(value, length, tm, 0, &status); err= status.warnings; - *param->error= test(err); + *param->error= MY_TEST(err); break; } case MYSQL_TYPE_DATE: @@ -3215,8 +3215,8 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, MYSQL_TIME_STATUS status; (void) str_to_datetime(value, length, tm, 0, &status); err= status.warnings; - *param->error= test(err) && (param->buffer_type == MYSQL_TYPE_DATE && - tm->time_type != MYSQL_TIMESTAMP_DATE); + *param->error= MY_TEST(err) && (param->buffer_type == MYSQL_TYPE_DATE && + tm->time_type != MYSQL_TIMESTAMP_DATE); break; } case MYSQL_TYPE_TINY_BLOB: @@ -3338,7 +3338,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, { int error; value= number_to_datetime(value, 0, (MYSQL_TIME *) buffer, 0, &error); - *param->error= test(error); + *param->error= MY_TEST(error); break; } default: @@ -3686,7 +3686,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, static void fetch_result_tinyint(MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row) { - my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG); uchar data= **row; *(uchar *)param->buffer= data; *param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX8; @@ -3696,7 +3696,7 @@ static void fetch_result_tinyint(MYSQL_BIND *param, MYSQL_FIELD *field, static void fetch_result_short(MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row) { - my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG); ushort data= (ushort) sint2korr(*row); shortstore(param->buffer, data); *param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX16; @@ -3707,7 +3707,7 @@ static void fetch_result_int32(MYSQL_BIND *param, MYSQL_FIELD *field __attribute__((unused)), uchar **row) { - my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG); uint32 data= (uint32) sint4korr(*row); longstore(param->buffer, data); *param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX32; @@ -3718,7 +3718,7 @@ static void fetch_result_int64(MYSQL_BIND *param, MYSQL_FIELD *field __attribute__((unused)), uchar **row) { - my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG); + my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG); ulonglong data= (ulonglong) sint8korr(*row); *param->error= param->is_unsigned != field_is_unsigned && data > LONGLONG_MAX; longlongstore(param->buffer, data); @@ -4711,7 +4711,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) my_free(stmt->extension); my_free(stmt); - DBUG_RETURN(test(rc)); + DBUG_RETURN(MY_TEST(rc)); } /* diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 86b3bc6a283..68955cb10f0 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -332,8 +332,8 @@ static int emb_stmt_execute(MYSQL_STMT *stmt) thd->client_param_count= stmt->param_count; thd->client_params= stmt->params; - res= test(emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE, 0, 0, - header, sizeof(header), 1, stmt) || + res= MY_TEST(emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE, 0, 0, + header, sizeof(header), 1, stmt) || emb_read_query_result(stmt->mysql)); stmt->affected_rows= stmt->mysql->affected_rows; stmt->insert_id= stmt->mysql->insert_id; diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 3c77e5f820a..7a7459673f5 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -117,7 +117,7 @@ my_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN *str) { if (str->length < 1) return FALSE; - return test(str->str[0] & DYNCOL_FLG_NAMES); + return MY_TEST(str->str[0] & DYNCOL_FLG_NAMES); } static enum enum_dyncol_func_result diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 3fa6ec28f7d..2008a6f8860 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -179,7 +179,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize, DBUG_ASSERT(seek_offset == 0); } else - info->seek_not_done= test(seek_offset != pos); + info->seek_not_done= MY_TEST(seek_offset != pos); } info->disk_writes= 0; diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 1ee71e55b68..b45b631283a 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -5651,7 +5651,7 @@ int flush_partitioned_key_cache_blocks(PARTITIONED_KEY_CACHE_CB *keycache, if ((type == FLUSH_KEEP || type == FLUSH_FORCE_WRITE) && !((*dirty_part_map) & ((ulonglong) 1 << i))) continue; - err|= test(flush_simple_key_cache_blocks(partition, file, 0, type)); + err|= MY_TEST(flush_simple_key_cache_blocks(partition, file, 0, type)); } *dirty_part_map= 0; diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index d61c7e171d0..fc30185eb5a 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -61,7 +61,7 @@ void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, mem_root->free= mem_root->used= mem_root->pre_alloc= 0; mem_root->min_malloc= 32; mem_root->block_size= (block_size - ALLOC_ROOT_MIN_BLOCK_SIZE) & ~1; - if (test(my_flags & MY_THREAD_SPECIFIC)) + if (MY_TEST(my_flags & MY_THREAD_SPECIFIC)) mem_root->block_size|= 1; mem_root->error_handler= 0; diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 58cacb9639d..8af572b5518 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -66,7 +66,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) from_file=to_file= -1; DBUG_ASSERT(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */ if (MyFlags & MY_HOLD_ORIGINAL_MODES) /* Copy stat if possible */ - new_file_stat= test(my_stat((char*) to, &new_stat_buff, MYF(0))); + new_file_stat= MY_TEST(my_stat((char*) to, &new_stat_buff, MYF(0))); if ((from_file=my_open(from,O_RDONLY | O_SHARE,MyFlags)) >= 0) { diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index 79ec58d3c5c..fbdcef88bda 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -157,12 +157,12 @@ int test_if_hard_path(register const char *dir_name) my_bool has_path(const char *name) { - return test(strchr(name, FN_LIBCHAR)) + return MY_TEST(strchr(name, FN_LIBCHAR)) #if FN_LIBCHAR != '/' - || test(strchr(name,'/')) + || MY_TEST(strchr(name, '/')) #endif #ifdef FN_DEVCHAR - || test(strchr(name, FN_DEVCHAR)) + || MY_TEST(strchr(name, FN_DEVCHAR)) #endif ; } diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c index 2f3a5276a59..fd65a54e5a4 100644 --- a/mysys/my_malloc.c +++ b/mysys/my_malloc.c @@ -112,9 +112,10 @@ void *my_malloc(size_t size, myf my_flags) } else { - MALLOC_STORE_SIZE(point, void*, size, test(my_flags & MY_THREAD_SPECIFIC)); + MALLOC_STORE_SIZE(point, void*, size, + MY_TEST(my_flags & MY_THREAD_SPECIFIC)); update_malloc_size(size + MALLOC_PREFIX_SIZE, - test(my_flags & MY_THREAD_SPECIFIC)); + MY_TEST(my_flags & MY_THREAD_SPECIFIC)); DBUG_EXECUTE_IF("simulate_out_of_memory", { /* my_free() handles memory accounting */ @@ -158,7 +159,7 @@ void *my_realloc(void *oldpoint, size_t size, myf my_flags) Test that the new and old area are the same, if not MY_THREAD_MOVE is given */ - DBUG_ASSERT((test(my_flags & MY_THREAD_SPECIFIC) == old_flags) || + DBUG_ASSERT((MY_TEST(my_flags & MY_THREAD_SPECIFIC) == old_flags) || (my_flags & MY_THREAD_MOVE)); if ((point= sf_realloc(MALLOC_FIX_POINTER_FOR_FREE(oldpoint), size + MALLOC_PREFIX_SIZE, my_flags)) == NULL) @@ -177,13 +178,14 @@ void *my_realloc(void *oldpoint, size_t size, myf my_flags) } else { - MALLOC_STORE_SIZE(point, void*, size, test(my_flags & MY_THREAD_SPECIFIC)); - if (test(my_flags & MY_THREAD_SPECIFIC) != old_flags) + MALLOC_STORE_SIZE(point, void*, size, + MY_TEST(my_flags & MY_THREAD_SPECIFIC)); + if (MY_TEST(my_flags & MY_THREAD_SPECIFIC) != old_flags) { /* memory moved between system and thread specific */ update_malloc_size(-(longlong) old_size - MALLOC_PREFIX_SIZE, old_flags); update_malloc_size((longlong) size + MALLOC_PREFIX_SIZE, - test(my_flags & MY_THREAD_SPECIFIC)); + MY_TEST(my_flags & MY_THREAD_SPECIFIC)); } else update_malloc_size((longlong)size - (longlong)old_size, old_flags); diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index f0447da42f6..5d19647c989 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -209,7 +209,7 @@ size_t sf_malloc_usable_size(void *ptr, my_bool *is_thread_specific) { struct st_irem *irem= (struct st_irem *)ptr - 1; DBUG_ENTER("sf_malloc_usable_size"); - *is_thread_specific= test(irem->flags & MY_THREAD_SPECIFIC); + *is_thread_specific= MY_TEST(irem->flags & MY_THREAD_SPECIFIC); DBUG_PRINT("exit", ("size: %lu flags: %lu", (ulong) irem->datasize, (ulong)irem->flags)); DBUG_RETURN(irem->datasize); diff --git a/mysys/tree.c b/mysys/tree.c index fe2d3f45d57..a9fc542faf6 100644 --- a/mysys/tree.c +++ b/mysys/tree.c @@ -127,7 +127,7 @@ void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit, tree->offset_to_key=0; /* use key through pointer */ tree->size_of_element+=sizeof(void*); } - if (!(tree->with_delete= test(my_flags & MY_TREE_WITH_DELETE))) + if (!(tree->with_delete= MY_TEST(my_flags & MY_TREE_WITH_DELETE))) { init_alloc_root(&tree->mem_root, default_alloc_size, 0, MYF(my_flags)); tree->mem_root.min_malloc= sizeof(TREE_ELEMENT)+tree->size_of_element; diff --git a/sql-common/client.c b/sql-common/client.c index fa2d9acfd03..a1ea9ed44e5 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1426,7 +1426,7 @@ void mysql_read_default_options(struct st_mysql_options *options, options->secure_auth= TRUE; break; case OPT_report_data_truncation: - options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1; + options->report_data_truncation= opt_arg ? MY_TEST(atoi(opt_arg)) : 1; break; case OPT_plugin_dir: { @@ -4392,7 +4392,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) mysql->options.protocol=MYSQL_PROTOCOL_PIPE; /* Force named pipe */ break; case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/ - if (!arg || test(*(uint*) arg)) + if (!arg || MY_TEST(*(uint*) arg)) mysql->options.client_flag|= CLIENT_LOCAL_FILES; else mysql->options.client_flag&= ~CLIENT_LOCAL_FILES; @@ -4439,7 +4439,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg) mysql->options.secure_auth= *(my_bool *) arg; break; case MYSQL_REPORT_DATA_TRUNCATION: - mysql->options.report_data_truncation= test(*(my_bool *) arg); + mysql->options.report_data_truncation= MY_TEST(*(my_bool*) arg); break; case MYSQL_OPT_RECONNECT: mysql->reconnect= *(my_bool *) arg; diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 34658ab51ac..b20269b8304 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -474,7 +474,7 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table, end: event_table->file->ha_index_end(); - DBUG_RETURN(test(ret)); + DBUG_RETURN(MY_TEST(ret)); } @@ -746,7 +746,7 @@ end: thd->mdl_context.rollback_to_savepoint(mdl_savepoint); thd->variables.sql_mode= saved_mode; - DBUG_RETURN(test(ret)); + DBUG_RETURN(MY_TEST(ret)); } @@ -861,7 +861,7 @@ end: thd->mdl_context.rollback_to_savepoint(mdl_savepoint); thd->variables.sql_mode= saved_mode; - DBUG_RETURN(test(ret)); + DBUG_RETURN(MY_TEST(ret)); } @@ -921,7 +921,7 @@ end: close_thread_tables(thd); thd->mdl_context.rollback_to_savepoint(mdl_savepoint); - DBUG_RETURN(test(ret)); + DBUG_RETURN(MY_TEST(ret)); } @@ -1159,7 +1159,7 @@ end: thd->restore_stmt_binlog_format(save_binlog_format); - DBUG_RETURN(test(ret)); + DBUG_RETURN(MY_TEST(ret)); } @@ -1237,7 +1237,7 @@ Event_db_repository::check_system_tables(THD *thd) close_mysql_tables(thd); } - DBUG_RETURN(test(ret)); + DBUG_RETURN(MY_TEST(ret)); } /** diff --git a/sql/field.cc b/sql/field.cc index 755d2f8b625..9ec0e4d3089 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1774,7 +1774,7 @@ int Field_num::store_decimal(const my_decimal *val) ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED; int err= 0; longlong i= convert_decimal2longlong(val, unsigned_flag, &err); - return test(err | store(i, unsigned_flag)); + return MY_TEST(err | store(i, unsigned_flag)); } @@ -1926,7 +1926,7 @@ int Field::store_time_dec(MYSQL_TIME *ltime, uint dec) bool Field::optimize_range(uint idx, uint part) { - return test(table->file->index_flags(idx, part, 1) & HA_READ_RANGE); + return MY_TEST(table->file->index_flags(idx, part, 1) & HA_READ_RANGE); } @@ -8487,7 +8487,7 @@ int Field_bit::store_decimal(const my_decimal *val) { int err= 0; longlong i= convert_decimal2longlong(val, 1, &err); - return test(err | store(i, TRUE)); + return MY_TEST(err | store(i, TRUE)); } @@ -8776,7 +8776,7 @@ Field_bit::unpack(uchar *to, const uchar *from, const uchar *from_end, if (param_data == 0 || ((from_bit_len == bit_len) && (from_len == bytes_in_rec))) { - if (from + bytes_in_rec + test(bit_len) > from_end) + if (from + bytes_in_rec + MY_TEST(bit_len) > from_end) return 0; // Error in data if (bit_len > 0) @@ -8931,7 +8931,7 @@ void Create_field::create_length_to_internal_length(void) { pack_length= length / 8; /* We need one extra byte to store the bits we save among the null bits */ - key_length= pack_length + test(length & 7); + key_length= pack_length + MY_TEST(length & 7); } break; case MYSQL_TYPE_NEWDECIMAL: diff --git a/sql/field.h b/sql/field.h index 72be8e3519a..5a1607c1cbf 100644 --- a/sql/field.h +++ b/sql/field.h @@ -67,7 +67,7 @@ enum Derivation #define MY_REPERTOIRE_NUMERIC MY_REPERTOIRE_ASCII /* The length of the header part for each virtual column in the .frm file */ -#define FRM_VCOL_HEADER_SIZE(b) (3 + test(b)) +#define FRM_VCOL_HEADER_SIZE(b) (3 + MY_TEST(b)) class Count_distinct_field; @@ -616,7 +616,7 @@ public: null_ptr[row_offset]. */ return (table->null_row ? TRUE : - null_ptr ? test(null_ptr[row_offset] & null_bit) : 0); + null_ptr ? MY_TEST(null_ptr[row_offset] & null_bit) : 0); } inline bool is_real_null(my_ptrdiff_t row_offset= 0) const { return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : 0; } @@ -624,8 +624,7 @@ public: { if (!null_ptr) return 0; - return test(record[(uint) (null_ptr -table->record[0])] & - null_bit); + return MY_TEST(record[(uint) (null_ptr - table->record[0])] & null_bit); } inline void set_null(my_ptrdiff_t row_offset= 0) { if (null_ptr) null_ptr[row_offset]|= null_bit; } @@ -1054,7 +1053,7 @@ public: my_decimal *val_decimal(my_decimal *); virtual bool str_needs_quotes() { return TRUE; } uint is_equal(Create_field *new_field); - bool eq_cmp_as_binary() { return test(flags & BINARY_FLAG); } + bool eq_cmp_as_binary() { return MY_TEST(flags & BINARY_FLAG); } virtual uint length_size() { return 0; } double pos_in_interval(Field *min, Field *max) { @@ -1654,7 +1653,7 @@ public: const char *field_name_arg, TABLE_SHARE *share, uint dec_arg) : Field_timestamp(ptr_arg, - MAX_DATETIME_WIDTH + dec_arg + test(dec_arg), null_ptr_arg, + MAX_DATETIME_WIDTH + dec_arg + MY_TEST(dec_arg), null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, share), dec(dec_arg) { @@ -1865,8 +1864,8 @@ public: Field_time_with_dec(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint dec_arg) - :Field_time(ptr_arg, MIN_TIME_WIDTH + dec_arg + test(dec_arg), null_ptr_arg, - null_bit_arg, unireg_check_arg, field_name_arg), + :Field_time(ptr_arg, MIN_TIME_WIDTH + dec_arg + MY_TEST(dec_arg), + null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg), dec(dec_arg) { DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS); @@ -2022,7 +2021,7 @@ public: Field_datetime_with_dec(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint dec_arg) - :Field_datetime(ptr_arg, MAX_DATETIME_WIDTH + dec_arg + test(dec_arg), + :Field_datetime(ptr_arg, MAX_DATETIME_WIDTH + dec_arg + MY_TEST(dec_arg), null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg), dec(dec_arg) { @@ -2649,9 +2648,9 @@ public: { DBUG_ASSERT(ptr == a || ptr == b); if (ptr == a) - return Field_bit::key_cmp(b, bytes_in_rec+test(bit_len)); + return Field_bit::key_cmp(b, bytes_in_rec + MY_TEST(bit_len)); else - return Field_bit::key_cmp(a, bytes_in_rec+test(bit_len)) * -1; + return Field_bit::key_cmp(a, bytes_in_rec + MY_TEST(bit_len)) * -1; } int cmp_binary_offset(uint row_offset) { return cmp_offset(row_offset); } diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 71ab4265ee3..97c82b9b7bf 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -399,7 +399,7 @@ static void do_field_int(Copy_field *copy) { longlong value= copy->from_field->val_int(); copy->to_field->store(value, - test(copy->from_field->flags & UNSIGNED_FLAG)); + MY_TEST(copy->from_field->flags & UNSIGNED_FLAG)); } static void do_field_real(Copy_field *copy) @@ -911,5 +911,5 @@ int field_conv(Field *to,Field *from) */ return to->store(result.c_ptr_quick(),result.length(),from->charset()); } - return to->store(from->val_int(), test(from->flags & UNSIGNED_FLAG)); + return to->store(from->val_int(), MY_TEST(from->flags & UNSIGNED_FLAG)); } diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 6fe3c826913..5b484076bca 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3421,7 +3421,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) m_mode= mode; m_open_test_lock= test_if_locked; m_part_field_array= m_part_info->full_part_field_array; - if (get_from_handler_file(name, &table->mem_root, test(m_is_clone_of))) + if (get_from_handler_file(name, &table->mem_root, MY_TEST(m_is_clone_of))) DBUG_RETURN(error); name_buffer_ptr= m_name_buffer_ptr; if (populate_partition_name_hash()) @@ -5694,7 +5694,7 @@ int ha_partition::read_range_first(const key_range *start_key, m_start_key.key= NULL; m_index_scan_type= partition_read_range; - error= common_index_read(m_rec0, test(start_key)); + error= common_index_read(m_rec0, MY_TEST(start_key)); DBUG_RETURN(error); } @@ -7689,8 +7689,8 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array) ulong nr1= 1; ulong nr2= 4; bool use_51_hash; - use_51_hash= test((*field_array)->table->part_info->key_algorithm == - partition_info::KEY_ALGORITHM_51); + use_51_hash= MY_TEST((*field_array)->table->part_info->key_algorithm == + partition_info::KEY_ALGORITHM_51); do { diff --git a/sql/handler.cc b/sql/handler.cc index 5b1e0ed58d1..e1a8b97874b 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2469,7 +2469,7 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode, cached_table_flags= table_flags(); } reset_statistics(); - internal_tmp_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE); + internal_tmp_table= MY_TEST(test_if_locked & HA_OPEN_INTERNAL_TABLE); DBUG_RETURN(error); } diff --git a/sql/handler.h b/sql/handler.h index ffb12d11648..d255c0543a9 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -3940,7 +3940,7 @@ static inline const char *ha_resolve_storage_engine_name(const handlerton *db_ty static inline bool ha_check_storage_engine_flag(const handlerton *db_type, uint32 flag) { - return db_type == NULL ? FALSE : test(db_type->flags & flag); + return db_type == NULL ? FALSE : MY_TEST(db_type->flags & flag); } static inline bool ha_storage_engine_is_enabled(const handlerton *db_type) diff --git a/sql/item.cc b/sql/item.cc index 1295902c1cd..191857413c2 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -852,7 +852,7 @@ void Item_ident::cleanup() table_name= orig_table_name; field_name= orig_field_name; /* Store if this Item was depended */ - can_be_depended= test(depended_from); + can_be_depended= MY_TEST(depended_from); DBUG_VOID_RETURN; } @@ -2428,7 +2428,7 @@ void Item_field::set_field(Field *field_par) field_name= field_par->field_name; db_name= field_par->table->s->db.str; alias_name_used= field_par->table->alias_name_used; - unsigned_flag=test(field_par->flags & UNSIGNED_FLAG); + unsigned_flag= MY_TEST(field_par->flags & UNSIGNED_FLAG); collation.set(field_par->charset(), field_par->derivation(), field_par->repertoire()); fix_char_length(field_par->char_length()); diff --git a/sql/item.h b/sql/item.h index f0986e3728d..de005c459ce 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1462,7 +1462,7 @@ public: { if (is_expensive_cache < 0) is_expensive_cache= walk(&Item::is_expensive_processor, 0, (uchar*)0); - return test(is_expensive_cache); + return MY_TEST(is_expensive_cache); } virtual Field::geometry_type get_geometry_type() const { return Field::GEOM_GEOMETRY; }; @@ -2400,7 +2400,7 @@ public: virtual void print(String *str, enum_query_type query_type); Item_num *neg() { value= -value; return this; } uint decimal_precision() const - { return (uint)(max_length - test(value < 0)); } + { return (uint) (max_length - MY_TEST(value < 0)); } bool eq(const Item *, bool binary_cmp) const; bool check_partition_func_processor(uchar *bool_arg) { return FALSE;} bool check_vcol_func_processor(uchar *arg) { return FALSE;} @@ -4225,7 +4225,7 @@ public: virtual void store(Item *item); virtual bool cache_value()= 0; bool basic_const_item() const - { return test(example && example->basic_const_item());} + { return MY_TEST(example && example->basic_const_item()); } virtual void clear() { null_value= TRUE; value_cached= FALSE; } bool is_null() { return null_value; } virtual bool is_expensive() diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 5852108dc43..4b9eb37488e 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -503,7 +503,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item, if (0 == field_cmp) { Item *tmp= new Item_int_with_ref(field->val_int(), *item, - test(field->flags & UNSIGNED_FLAG)); + MY_TEST(field->flags & UNSIGNED_FLAG)); if (tmp) thd->change_item_tree(item, tmp); result= 1; // Item was replaced @@ -1044,8 +1044,8 @@ int Arg_comparator::compare_e_string() res1= (*a)->val_str(&value1); res2= (*b)->val_str(&value2); if (!res1 || !res2) - return test(res1 == res2); - return test(sortcmp(res1, res2, cmp_collation.collation) == 0); + return MY_TEST(res1 == res2); + return MY_TEST(sortcmp(res1, res2, cmp_collation.collation) == 0); } @@ -1055,8 +1055,8 @@ int Arg_comparator::compare_e_binary_string() res1= (*a)->val_str(&value1); res2= (*b)->val_str(&value2); if (!res1 || !res2) - return test(res1 == res2); - return test(stringcmp(res1, res2) == 0); + return MY_TEST(res1 == res2); + return MY_TEST(stringcmp(res1, res2) == 0); } @@ -1111,8 +1111,8 @@ int Arg_comparator::compare_e_real() double val1= (*a)->val_real(); double val2= (*b)->val_real(); if ((*a)->null_value || (*b)->null_value) - return test((*a)->null_value && (*b)->null_value); - return test(val1 == val2); + return MY_TEST((*a)->null_value && (*b)->null_value); + return MY_TEST(val1 == val2); } int Arg_comparator::compare_e_decimal() @@ -1121,8 +1121,8 @@ int Arg_comparator::compare_e_decimal() my_decimal *val1= (*a)->val_decimal(&decimal1); my_decimal *val2= (*b)->val_decimal(&decimal2); if ((*a)->null_value || (*b)->null_value) - return test((*a)->null_value && (*b)->null_value); - return test(my_decimal_cmp(val1, val2) == 0); + return MY_TEST((*a)->null_value && (*b)->null_value); + return MY_TEST(my_decimal_cmp(val1, val2) == 0); } @@ -1160,8 +1160,8 @@ int Arg_comparator::compare_e_real_fixed() double val1= (*a)->val_real(); double val2= (*b)->val_real(); if ((*a)->null_value || (*b)->null_value) - return test((*a)->null_value && (*b)->null_value); - return test(val1 == val2 || fabs(val1 - val2) < precision); + return MY_TEST((*a)->null_value && (*b)->null_value); + return MY_TEST(val1 == val2 || fabs(val1 - val2) < precision); } @@ -1272,8 +1272,8 @@ int Arg_comparator::compare_e_int() longlong val1= (*a)->val_int(); longlong val2= (*b)->val_int(); if ((*a)->null_value || (*b)->null_value) - return test((*a)->null_value && (*b)->null_value); - return test(val1 == val2); + return MY_TEST((*a)->null_value && (*b)->null_value); + return MY_TEST(val1 == val2); } /** @@ -1284,8 +1284,8 @@ int Arg_comparator::compare_e_int_diff_signedness() longlong val1= (*a)->val_int(); longlong val2= (*b)->val_int(); if ((*a)->null_value || (*b)->null_value) - return test((*a)->null_value && (*b)->null_value); - return (val1 >= 0) && test(val1 == val2); + return MY_TEST((*a)->null_value && (*b)->null_value); + return (val1 >= 0) && MY_TEST(val1 == val2); } int Arg_comparator::compare_row() diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index a0d9b7c20fa..6159014a10c 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -388,7 +388,7 @@ public: Item_func::print_op(str, query_type); } - bool is_null() { return test(args[0]->is_null() || args[1]->is_null()); } + bool is_null() { return MY_TEST(args[0]->is_null() || args[1]->is_null()); } bool is_bool_func() { return 1; } CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; } uint decimal_precision() const { return 1; } @@ -874,7 +874,7 @@ public: /* Compare values number pos1 and pos2 for equality */ bool compare_elems(uint pos1, uint pos2) { - return test(compare(collation, base + pos1*size, base + pos2*size)); + return MY_TEST(compare(collation, base + pos1 * size, base + pos2 * size)); } virtual Item_result result_type()= 0; }; @@ -1838,7 +1838,7 @@ public: bool contains(Field *field); Item* get_first(struct st_join_table *context, Item *field); /** Get number of field items / references to field items in this object */ - uint n_field_items() { return equal_items.elements-test(with_const); } + uint n_field_items() { return equal_items.elements - MY_TEST(with_const); } void merge(Item_equal *item); bool merge_with_check(Item_equal *equal_item, bool save_merged); void merge_into_list(List<Item_equal> *list, bool save_merged, diff --git a/sql/item_func.cc b/sql/item_func.cc index 9918b7c40f6..2fe47406b9e 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2615,7 +2615,8 @@ void Item_func_round::fix_length_and_dec() case INT_RESULT: if ((!decimals_to_set && truncate) || (args[0]->decimal_precision() < DECIMAL_LONGLONG_DIGITS)) { - int length_can_increase= test(!truncate && (val1 < 0) && !val1_unsigned); + int length_can_increase= MY_TEST(!truncate && (val1 < 0) && + !val1_unsigned); max_length= args[0]->max_length + length_can_increase; /* Here we can keep INT_RESULT */ cached_result_type= INT_RESULT; @@ -4617,7 +4618,7 @@ longlong Item_func_sleep::val_int() mysql_cond_destroy(&cond); - return test(!error); // Return 1 killed + return MY_TEST(!error); // Return 1 killed } @@ -6684,7 +6685,7 @@ void Item_func_sp::fix_length_and_dec() max_length= sp_result_field->field_length; collation.set(sp_result_field->charset()); maybe_null= 1; - unsigned_flag= test(sp_result_field->flags & UNSIGNED_FLAG); + unsigned_flag= MY_TEST(sp_result_field->flags & UNSIGNED_FLAG); DBUG_VOID_RETURN; } diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 665c941414c..aeef3e42817 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -244,7 +244,7 @@ String *Item_func_centroid::val_str(String *str) srid= uint4korr(swkb->ptr()); str->q_append(srid); - return (null_value= test(geom->centroid(str))) ? 0 : str; + return (null_value= MY_TEST(geom->centroid(str))) ? 0 : str; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 1947dae0c50..e426489d0e9 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -4784,7 +4784,7 @@ String *Item_dyncol_get::val_str(String *str_result) goto null; case DYN_COL_INT: case DYN_COL_UINT: - str_result->set_int(val.x.long_value, test(val.type == DYN_COL_UINT), + str_result->set_int(val.x.long_value, MY_TEST(val.type == DYN_COL_UINT), &my_charset_latin1); break; case DYN_COL_DOUBLE: diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 88cae108039..35d137c4357 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -3399,7 +3399,7 @@ bool subselect_union_engine::is_executed() const bool subselect_union_engine::no_rows() { /* Check if we got any rows when reading UNION result from temp. table: */ - return test(!unit->fake_select_lex->join->send_records); + return MY_TEST(!unit->fake_select_lex->join->send_records); } @@ -5241,8 +5241,8 @@ int subselect_hash_sj_engine::exec() /* The subquery should be optimized, and materialized only once. */ DBUG_ASSERT(materialize_join->optimized && !is_materialized); materialize_join->exec(); - if ((res= test(materialize_join->error || thd->is_fatal_error || - thd->is_error()))) + if ((res= MY_TEST(materialize_join->error || thd->is_fatal_error || + thd->is_error()))) goto err; /* @@ -5325,7 +5325,7 @@ int subselect_hash_sj_engine::exec() count_pm_keys= count_partial_match_columns - count_null_only_columns + (nn_key_parts ? 1 : 0); - choose_partial_match_strategy(test(nn_key_parts), + choose_partial_match_strategy(MY_TEST(nn_key_parts), has_covering_null_row, &partial_match_key_parts); DBUG_ASSERT(strategy == PARTIAL_MATCH_MERGE || @@ -6300,7 +6300,7 @@ bool subselect_rowid_merge_engine::partial_match() Do not add the non_null_key, since it was already processed above. */ bitmap_clear_all(&matching_outer_cols); - for (uint i= test(non_null_key); i < merge_keys_count; i++) + for (uint i= MY_TEST(non_null_key); i < merge_keys_count; i++) { DBUG_ASSERT(merge_keys[i]->get_column_count() == 1); if (merge_keys[i]->get_search_key(0)->null_value) @@ -6317,7 +6317,7 @@ bool subselect_rowid_merge_engine::partial_match() nullable columns (above we guarantee there is a match for the non-null coumns), the result is UNKNOWN. */ - if (count_nulls_in_search_key == merge_keys_count - test(non_null_key)) + if (count_nulls_in_search_key == merge_keys_count - MY_TEST(non_null_key)) { res= TRUE; goto end; diff --git a/sql/item_subselect.h b/sql/item_subselect.h index e806f45041a..b8e929f3fc5 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -566,7 +566,7 @@ public: if ( pushed_cond_guards) pushed_cond_guards[i]= v; } - bool have_guarded_conds() { return test(pushed_cond_guards); } + bool have_guarded_conds() { return MY_TEST(pushed_cond_guards); } Item_func_not_all *upper_item; // point on NOT/NOP before ALL/SOME subquery @@ -621,7 +621,7 @@ public: int get_identifier(); bool test_strategy(uchar strategy) - { return test(in_strategy & strategy); } + { return MY_TEST(in_strategy & strategy); } /** Test that the IN strategy was chosen for execution. This is so @@ -641,7 +641,7 @@ public: } bool is_set_strategy() - { return test(in_strategy & SUBS_STRATEGY_CHOSEN); } + { return MY_TEST(in_strategy & SUBS_STRATEGY_CHOSEN); } bool has_strategy() { return in_strategy != SUBS_NOT_TRANSFORMED; } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 40929c12e3c..b76474e6346 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1077,7 +1077,7 @@ longlong Item_func_weekday::val_int() return (longlong) calc_weekday(calc_daynr(ltime.year, ltime.month, ltime.day), - odbc_type) + test(odbc_type); + odbc_type) + MY_TEST(odbc_type); } void Item_func_dayname::fix_length_and_dec() diff --git a/sql/key.cc b/sql/key.cc index 8ba3d48e8dc..2df9c7e0cb5 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -126,8 +126,8 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info, { if (key_part->null_bit) { - *to_key++= test(from_record[key_part->null_offset] & - key_part->null_bit); + *to_key++= MY_TEST(from_record[key_part->null_offset] & + key_part->null_bit); key_length--; if (to_key[-1]) { @@ -300,8 +300,8 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length) if (key_part->null_bit) { - if (*key != test(table->record[0][key_part->null_offset] & - key_part->null_bit)) + if (*key != MY_TEST(table->record[0][key_part->null_offset] & + key_part->null_bit)) return 1; if (*key) continue; @@ -438,7 +438,7 @@ void key_unpack(String *to, TABLE *table, KEY *key) } } field_unpack(to, key_part->field, table->record[0], key_part->length, - test(key_part->key_part_flag & HA_PART_KEY_SEG)); + MY_TEST(key_part->key_part_flag & HA_PART_KEY_SEG)); } dbug_tmp_restore_column_map(table->read_set, old_map); DBUG_VOID_RETURN; diff --git a/sql/log_event.cc b/sql/log_event.cc index 29732b28841..ad9336712cf 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -749,7 +749,7 @@ static void print_set_option(IO_CACHE* file, uint32 bits_changed, { if (*need_comma) my_b_write(file, ", ", 2); - my_b_printf(file,"%s=%d", name, test(flags & option)); + my_b_printf(file, "%s=%d", name, MY_TEST(flags & option)); *need_comma= 1; } } @@ -1089,7 +1089,7 @@ my_bool Log_event::need_checksum() (checksum_alg != BINLOG_CHECKSUM_ALG_OFF) : ((binlog_checksum_options != BINLOG_CHECKSUM_ALG_OFF) && (cache_type == Log_event::EVENT_NO_CACHE)) ? - test(binlog_checksum_options) : FALSE); + MY_TEST(binlog_checksum_options) : FALSE); /* FD calls the methods before data_written has been calculated. diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index 03023927a1d..0c35ac5b029 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -225,7 +225,7 @@ handler::multi_range_read_init(RANGE_SEQ_IF *seq_funcs, void *seq_init_param, DBUG_ENTER("handler::multi_range_read_init"); mrr_iter= seq_funcs->init(seq_init_param, n_ranges, mode); mrr_funcs= *seq_funcs; - mrr_is_output_sorted= test(mode & HA_MRR_SORTED); + mrr_is_output_sorted= MY_TEST(mode & HA_MRR_SORTED); mrr_have_range= FALSE; DBUG_RETURN(0); } @@ -292,7 +292,7 @@ scan_it_again: &mrr_cur_range.start_key : 0, mrr_cur_range.end_key.keypart_map ? &mrr_cur_range.end_key : 0, - test(mrr_cur_range.range_flag & EQ_RANGE), + MY_TEST(mrr_cur_range.range_flag & EQ_RANGE), mrr_is_output_sorted); if (result != HA_ERR_END_OF_FILE) break; @@ -549,12 +549,12 @@ int Mrr_ordered_index_reader::init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, keypar= *key_par_arg; KEY *key_info= &file->get_table()->key_info[file->active_index]; - keypar.index_ranges_unique= test(key_info->flags & HA_NOSAME && - key_info->user_defined_key_parts == - my_count_bits(keypar.key_tuple_map)); + keypar.index_ranges_unique= MY_TEST(key_info->flags & HA_NOSAME && + key_info->user_defined_key_parts == + my_count_bits(keypar.key_tuple_map)); mrr_iter= seq_funcs->init(seq_init_param, n_ranges, mode); - is_mrr_assoc= !test(mode & HA_MRR_NO_ASSOCIATION); + is_mrr_assoc= !MY_TEST(mode & HA_MRR_NO_ASSOCIATION); mrr_funcs= *seq_funcs; source_exhausted= FALSE; if (support_scan_interruptions) @@ -578,7 +578,7 @@ int Mrr_ordered_rndpos_reader::init(handler *h_arg, file= h_arg; index_reader= index_reader_arg; rowid_buffer= buf; - is_mrr_assoc= !test(mode & HA_MRR_NO_ASSOCIATION); + is_mrr_assoc= !MY_TEST(mode & HA_MRR_NO_ASSOCIATION); index_reader_exhausted= FALSE; index_reader_needs_refill= TRUE; return 0; @@ -817,7 +817,7 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, has not been called, so set the owner handler here as well. */ primary_file= h_arg; - is_mrr_assoc= !test(mode & HA_MRR_NO_ASSOCIATION); + is_mrr_assoc= !MY_TEST(mode & HA_MRR_NO_ASSOCIATION); strategy_exhausted= FALSE; @@ -867,7 +867,7 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, if (do_sort_keys) { /* Pre-calculate some parameters of key sorting */ - keypar.use_key_pointers= test(mode & HA_MRR_MATERIALIZED_KEYS); + keypar.use_key_pointers= MY_TEST(mode & HA_MRR_MATERIALIZED_KEYS); seq_funcs->get_key_info(seq_init_param, &keypar.key_tuple_length, &keypar.key_tuple_map); keypar.key_size_in_keybuf= keypar.use_key_pointers? @@ -996,7 +996,7 @@ use_default_impl: so small that it can accomodate one rowid and one index tuple) */ if ((res= primary_file->ha_rnd_end()) || - (res= primary_file->ha_index_init(keyno, test(mode & HA_MRR_SORTED)))) + (res= primary_file->ha_index_init(keyno, MY_TEST(mode & HA_MRR_SORTED)))) { DBUG_RETURN(res); } @@ -1521,10 +1521,10 @@ bool key_uses_partial_cols(TABLE_SHARE *share, uint keyno) bool DsMrr_impl::check_cpk_scan(THD *thd, TABLE_SHARE *share, uint keyno, uint mrr_flags) { - return test((mrr_flags & HA_MRR_SINGLE_POINT) && - keyno == share->primary_key && - primary_file->primary_key_is_clustered() && - optimizer_flag(thd, OPTIMIZER_SWITCH_MRR_SORT_KEYS)); + return MY_TEST((mrr_flags & HA_MRR_SINGLE_POINT) && + keyno == share->primary_key && + primary_file->primary_key_is_clustered() && + optimizer_flag(thd, OPTIMIZER_SWITCH_MRR_SORT_KEYS)); } @@ -1561,8 +1561,8 @@ bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags, TABLE_SHARE *share= primary_file->get_table_share(); bool doing_cpk_scan= check_cpk_scan(thd, share, keyno, *flags); - bool using_cpk= test(keyno == share->primary_key && - primary_file->primary_key_is_clustered()); + bool using_cpk= MY_TEST(keyno == share->primary_key && + primary_file->primary_key_is_clustered()); *flags &= ~HA_MRR_IMPLEMENTATION_FLAGS; if (!optimizer_flag(thd, OPTIMIZER_SWITCH_MRR) || *flags & HA_MRR_INDEX_ONLY || @@ -1685,7 +1685,7 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags, double index_read_cost; elem_size= primary_file->ref_length + - sizeof(void*) * (!test(flags & HA_MRR_NO_ASSOCIATION)); + sizeof(void*) * (!MY_TEST(flags & HA_MRR_NO_ASSOCIATION)); max_buff_entries = *buffer_size / elem_size; if (!max_buff_entries) diff --git a/sql/my_apc.h b/sql/my_apc.h index 4643e641ff1..dfeef5eb8ac 100644 --- a/sql/my_apc.h +++ b/sql/my_apc.h @@ -62,7 +62,7 @@ public: */ inline bool have_apc_requests() { - return test(apc_calls); + return MY_TEST(apc_calls); } inline bool is_enabled() { return enabled; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 75495491980..13b1532f438 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8359,7 +8359,7 @@ mysqld_get_one_option(int optid, opt_myisam_log=1; break; case (int) OPT_BIN_LOG: - opt_bin_log= test(argument != disabled_my_option); + opt_bin_log= MY_TEST(argument != disabled_my_option); opt_bin_log_used= 1; break; case (int) OPT_LOG_BASENAME: @@ -8865,7 +8865,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr) Set some global variables from the global_system_variables In most cases the global variables will not be used */ - my_disable_locking= myisam_single_user= test(opt_external_locking == 0); + my_disable_locking= myisam_single_user= MY_TEST(opt_external_locking == 0); my_default_record_cache_size=global_system_variables.read_buff_size; /* @@ -8922,8 +8922,8 @@ static int get_options(int *argc_ptr, char ***argv_ptr) #endif global_system_variables.engine_condition_pushdown= - test(global_system_variables.optimizer_switch & - OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN); + MY_TEST(global_system_variables.optimizer_switch & + OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN); opt_readonly= read_only; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index b7ee46361ae..546542fa207 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -144,7 +144,7 @@ my_bool my_net_init(NET *net, Vio* vio, uint my_flags) net->net_skip_rest_factor= 0; net->last_errno=0; net->unused= 0; - net->thread_specific_malloc= test(my_flags & MY_THREAD_SPECIFIC); + net->thread_specific_malloc= MY_TEST(my_flags & MY_THREAD_SPECIFIC); #ifdef MYSQL_SERVER net->extension= NULL; #endif @@ -267,7 +267,7 @@ static int net_data_is_ready(my_socket sd) if ((res= select((int) (sd + 1), &sfds, NULL, NULL, &tv)) < 0) return 0; else - return test(res ? FD_ISSET(sd, &sfds) : 0); + return MY_TEST(res ? FD_ISSET(sd, &sfds) : 0); #endif /* HAVE_POLL */ } @@ -360,8 +360,8 @@ my_bool net_flush(NET *net) DBUG_ENTER("net_flush"); if (net->buff != net->write_pos) { - error=test(net_real_write(net, net->buff, - (size_t) (net->write_pos - net->buff))); + error= MY_TEST(net_real_write(net, net->buff, + (size_t) (net->write_pos - net->buff))); net->write_pos= net->buff; } /* Sync packet number if using compression */ @@ -424,7 +424,7 @@ my_bool my_net_write(NET *net, const uchar *packet, size_t len) #ifndef DEBUG_DATA_PACKETS DBUG_DUMP("packet_header", buff, NET_HEADER_SIZE); #endif - rc= test(net_write_buff(net,packet,len)); + rc= MY_TEST(net_write_buff(net, packet, len)); MYSQL_NET_WRITE_DONE(rc); return rc; } @@ -498,9 +498,9 @@ net_write_command(NET *net,uchar command, } int3store(buff,length); buff[3]= (uchar) net->pkt_nr++; - rc= test(net_write_buff(net, buff, header_size) || - (head_len && net_write_buff(net, header, head_len)) || - net_write_buff(net, packet, len) || net_flush(net)); + rc= MY_TEST(net_write_buff(net, buff, header_size) || + (head_len && net_write_buff(net, header, head_len)) || + net_write_buff(net, packet, len) || net_flush(net)); MYSQL_NET_WRITE_DONE(rc); DBUG_RETURN(rc); } diff --git a/sql/opt_index_cond_pushdown.cc b/sql/opt_index_cond_pushdown.cc index fb55aea1968..be33e46bf94 100644 --- a/sql/opt_index_cond_pushdown.cc +++ b/sql/opt_index_cond_pushdown.cc @@ -205,7 +205,7 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno, new_cond->argument_list()->push_back(fix); used_tables|= fix->used_tables(); } - if (test(item->marker == ICP_COND_USES_INDEX_ONLY)) + if (MY_TEST(item->marker == ICP_COND_USES_INDEX_ONLY)) { n_marked++; item->marker= 0; @@ -238,7 +238,7 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno, if (!fix) return (COND*) 0; new_cond->argument_list()->push_back(fix); - if (test(item->marker == ICP_COND_USES_INDEX_ONLY)) + if (MY_TEST(item->marker == ICP_COND_USES_INDEX_ONLY)) { n_marked++; item->marker= 0; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 1ced92952c2..d41d6f7568a 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -408,7 +408,7 @@ public: new_max=arg->max_value; flag_max=arg->max_flag; } return new SEL_ARG(field, part, new_min, new_max, flag_min, flag_max, - test(maybe_flag && arg->maybe_flag)); + MY_TEST(maybe_flag && arg->maybe_flag)); } SEL_ARG *clone_first(SEL_ARG *arg) { // min <= X < arg->min @@ -3223,7 +3223,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, Assume that if the user is using 'limit' we will only need to scan limit rows if we are using a key */ - DBUG_RETURN(records ? test(quick) : -1); + DBUG_RETURN(records ? MY_TEST(quick) : -1); } /**************************************************************************** @@ -3782,8 +3782,8 @@ typedef struct st_part_prune_param int last_subpart_partno; /* Same as above for supartitioning */ /* - is_part_keypart[i] == test(keypart #i in partitioning index is a member - used in partitioning) + is_part_keypart[i] == MY_TEST(keypart #i in partitioning index is a member + used in partitioning) Used to maintain current values of cur_part_fields and cur_subpart_fields */ my_bool *is_part_keypart; @@ -3974,7 +3974,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond) res == 1 => some used partitions => retval=FALSE res == -1 - we jump over this line to all_used: */ - retval= test(!res); + retval= MY_TEST(!res); goto end; all_used: @@ -4607,7 +4607,7 @@ process_next_key_part: ppar->mark_full_partition_used(ppar->part_info, part_id); found= TRUE; } - res= test(found); + res= MY_TEST(found); } /* Restore the "used partitions iterator" to the default setting that @@ -5649,7 +5649,7 @@ bool prepare_search_best_index_intersect(PARAM *param, } } - i= n_index_scans - test(cpk_scan != NULL) + 1; + i= n_index_scans - MY_TEST(cpk_scan != NULL) + 1; if (!(common->search_scans = (INDEX_SCAN_INFO **) alloc_root (param->mem_root, @@ -5719,7 +5719,7 @@ bool prepare_search_best_index_intersect(PARAM *param, if (!(common->best_intersect= (INDEX_SCAN_INFO **) alloc_root (param->mem_root, sizeof(INDEX_SCAN_INFO *) * - (i + test(cpk_scan != NULL))))) + (i + MY_TEST(cpk_scan != NULL))))) return TRUE; size_t calc_cost_buff_size= @@ -6571,8 +6571,8 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, SEL_ARG *sel_arg, *tuple_arg= NULL; key_part_map keypart_map= 0; bool cur_covered; - bool prev_covered= test(bitmap_is_set(&info->covered_fields, - key_part->fieldnr-1)); + bool prev_covered= MY_TEST(bitmap_is_set(&info->covered_fields, + key_part->fieldnr - 1)); key_range min_range; key_range max_range; min_range.key= key_val; @@ -6586,8 +6586,8 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, sel_arg= sel_arg->next_key_part) { DBUG_PRINT("info",("sel_arg step")); - cur_covered= test(bitmap_is_set(&info->covered_fields, - key_part[sel_arg->part].fieldnr-1)); + cur_covered= MY_TEST(bitmap_is_set(&info->covered_fields, + key_part[sel_arg->part].fieldnr - 1)); if (cur_covered != prev_covered) { /* create (part1val, ..., part{n-1}val) tuple. */ @@ -10681,12 +10681,12 @@ get_quick_select(PARAM *param,uint idx,SEL_ARG *key_tree, uint mrr_flags, if (param->table->key_info[param->real_keynr[idx]].flags & HA_SPATIAL) quick=new QUICK_RANGE_SELECT_GEOM(param->thd, param->table, param->real_keynr[idx], - test(parent_alloc), + MY_TEST(parent_alloc), parent_alloc, &create_err); else quick=new QUICK_RANGE_SELECT(param->thd, param->table, param->real_keynr[idx], - test(parent_alloc), NULL, &create_err); + MY_TEST(parent_alloc), NULL, &create_err); if (quick) { @@ -11681,7 +11681,7 @@ int QUICK_RANGE_SELECT::get_next_prefix(uint prefix_length, result= file->read_range_first(last_range->min_keypart_map ? &start_key : 0, last_range->max_keypart_map ? &end_key : 0, - test(last_range->flag & EQ_RANGE), + MY_TEST(last_range->flag & EQ_RANGE), TRUE); if (last_range->flag == (UNIQUE_RANGE | EQ_RANGE)) last_range= 0; // Stop searching diff --git a/sql/opt_range.h b/sql/opt_range.h index 4f2ab6df60d..1ca245ea420 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -1004,7 +1004,7 @@ class SQL_SELECT :public Sql_alloc { */ inline int skip_record(THD *thd) { - int rc= test(!cond || cond->val_int()); + int rc= MY_TEST(!cond || cond->val_int()); if (thd->is_error()) rc= -1; return rc; diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 8c38a2d4eb9..4079298f6c0 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -1082,7 +1082,7 @@ bool convert_join_subqueries_to_semijoins(JOIN *join) if (convert_join_subqueries_to_semijoins(child_join)) DBUG_RETURN(TRUE); in_subq->sj_convert_priority= - test(in_subq->emb_on_expr_nest != NO_JOIN_NEST) * MAX_TABLES * 2 + + MY_TEST(in_subq->emb_on_expr_nest != NO_JOIN_NEST) * MAX_TABLES * 2 + in_subq->is_correlated * MAX_TABLES + child_join->outer_tables; } @@ -2384,7 +2384,7 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables) if (!is_excluded_key) { keyinfo= table->key_info + key; - is_excluded_key= !test(keyinfo->flags & HA_NOSAME); + is_excluded_key= !MY_TEST(keyinfo->flags & HA_NOSAME); } if (!is_excluded_key) { @@ -2471,8 +2471,8 @@ bool is_multiple_semi_joins(JOIN *join, POSITION *prefix, uint idx, table_map in if ((emb_sj_nest= prefix[i].table->emb_sj_nest)) { if (inner_tables & emb_sj_nest->sj_inner_tables) - return !test(inner_tables == (emb_sj_nest->sj_inner_tables & - ~join->const_table_map)); + return !MY_TEST(inner_tables == (emb_sj_nest->sj_inner_tables & + ~join->const_table_map)); } } return FALSE; @@ -3206,9 +3206,9 @@ at_sjmat_pos(const JOIN *join, table_map remaining_tables, const JOIN_TAB *tab, if (join->positions[idx - i].table->emb_sj_nest != tab->emb_sj_nest) return NULL; } - *loose_scan= test(remaining_tables & ~tab->table->map & - (emb_sj_nest->sj_inner_tables | - emb_sj_nest->nested_join->sj_depends_on)); + *loose_scan= MY_TEST(remaining_tables & ~tab->table->map & + (emb_sj_nest->sj_inner_tables | + emb_sj_nest->nested_join->sj_depends_on)); if (*loose_scan && !emb_sj_nest->sj_subq_pred->sjm_scan_allowed) return NULL; else @@ -3594,12 +3594,12 @@ bool setup_sj_materialization_part2(JOIN_TAB *sjm_tab) for (i= 0; i < tmp_key_parts; i++, cur_key_part++, ref_key++) { tab_ref->items[i]= emb_sj_nest->sj_subq_pred->left_expr->element_index(i); - int null_count= test(cur_key_part->field->real_maybe_null()); + int null_count= MY_TEST(cur_key_part->field->real_maybe_null()); *ref_key= new store_key_item(thd, cur_key_part->field, /* TODO: the NULL byte is taken into account in cur_key_part->store_length, so instead of - cur_ref_buff + test(maybe_null), we could + cur_ref_buff + MY_TEST(maybe_null), we could use that information instead. */ cur_ref_buff + null_count, @@ -3828,7 +3828,7 @@ static bool is_cond_sj_in_equality(Item *item) ((Item_func*)item)->functype()== Item_func::EQ_FUNC) { Item_func_eq *item_eq= (Item_func_eq*)item; - return test(item_eq->in_equality_no != UINT_MAX); + return MY_TEST(item_eq->in_equality_no != UINT_MAX); } return FALSE; } @@ -4100,7 +4100,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd) { DBUG_PRINT("info",("Creating group key in temporary table")); share->keys=1; - share->uniques= test(using_unique_constraint); + share->uniques= MY_TEST(using_unique_constraint); table->key_info=keyinfo; keyinfo->key_part=key_part_info; keyinfo->flags=HA_NOSAME; diff --git a/sql/opt_subselect.h b/sql/opt_subselect.h index 6ed077dcfcb..dabf2f95bcc 100644 --- a/sql/opt_subselect.h +++ b/sql/opt_subselect.h @@ -168,7 +168,7 @@ public: } } - bool have_a_case() { return test(handled_sj_equalities); } + bool have_a_case() { return MY_TEST(handled_sj_equalities); } void check_ref_access_part1(JOIN_TAB *s, uint key, KEYUSE *start_key, table_map found_part) diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index d4fc458c948..4e8fcefa6d2 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -295,9 +295,9 @@ int opt_sum_query(THD *thd, if (!(tl->table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT) || tl->schema_table) { - maybe_exact_count&= test(!tl->schema_table && - (tl->table->file->ha_table_flags() & - HA_HAS_RECORDS)); + maybe_exact_count&= MY_TEST(!tl->schema_table && + (tl->table->file->ha_table_flags() & + HA_HAS_RECORDS)); is_exact_count= FALSE; count= 1; // ensure count != 0 } @@ -361,7 +361,7 @@ int opt_sum_query(THD *thd, case Item_sum::MIN_FUNC: case Item_sum::MAX_FUNC: { - int is_max= test(item_sum->sum_func() == Item_sum::MAX_FUNC); + int is_max= MY_TEST(item_sum->sum_func() == Item_sum::MAX_FUNC); /* If MIN/MAX(expr) is the first part of a key or if all previous parts of the key is found in the COND, then we can use @@ -658,7 +658,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo, DBUG_RETURN(FALSE); } if (!(cond->used_tables() & field->table->map) && - test(cond->used_tables() & ~PSEUDO_TABLE_BITS)) + MY_TEST(cond->used_tables() & ~PSEUDO_TABLE_BITS)) { /* Condition doesn't restrict the used table */ DBUG_RETURN(!cond->const_item()); @@ -811,7 +811,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo, Item *value= args[between && max_fl ? 2 : 1]; value->save_in_field_no_warnings(part->field, 1); if (part->null_bit) - *key_ptr++= (uchar) test(part->field->is_null()); + *key_ptr++= (uchar) MY_TEST(part->field->is_null()); part->field->get_key_image(key_ptr, part->length, Field::itRAW); } if (is_field_part) @@ -831,7 +831,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo, else if (eq_type) { if ((!is_null && !cond->val_int()) || - (is_null && !test(part->field->is_null()))) + (is_null && !MY_TEST(part->field->is_null()))) DBUG_RETURN(FALSE); // Impossible test } else if (is_field_part) diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index 9b58f5f3126..2ef565517b5 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -356,7 +356,7 @@ public: bound. */ void touch() { unbound_args--; } - bool is_applicable() { return !test(unbound_args); } + bool is_applicable() { return !MY_TEST(unbound_args); } /* Iteration over values that */ typedef char *Iterator; @@ -1072,7 +1072,7 @@ bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module> else { /* It's a multi-equality */ - eq_mod->unbound_args= !test(eq_mod->expr); + eq_mod->unbound_args= !MY_TEST(eq_mod->expr); List_iterator<Dep_value_field> it(*eq_mod->mult_equal_fields); Dep_value_field* field_val; while ((field_val= it++)) @@ -1398,7 +1398,7 @@ Dep_module_expr *merge_eq_mods(Dep_module_expr *start, } } - if (fv->elements + test(old->expr) > 1) + if (fv->elements + MY_TEST(old->expr) > 1) { old->mult_equal_fields= fv; old->level= and_level; diff --git a/sql/password.c b/sql/password.c index 22e0060abd2..7a3d8aafde3 100644 --- a/sql/password.c +++ b/sql/password.c @@ -510,7 +510,7 @@ check_scramble(const uchar *scramble_arg, const char *message, /* now buf supposedly contains hash_stage1: so we can get hash_stage2 */ compute_sha1_hash(hash_stage2_reassured, (const char *) buf, SHA1_HASH_SIZE); - return test(memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE)); + return MY_TEST(memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE)); } /* diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index fced238e334..7764400becb 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -547,7 +547,7 @@ file '%s')", fname); mi->rli.is_relay_log_recovery= FALSE; // now change cache READ -> WRITE - must do this before flush_master_info reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1); - if ((error=test(flush_master_info(mi, TRUE, TRUE)))) + if ((error= MY_TEST(flush_master_info(mi, TRUE, TRUE)))) sql_print_error("Failed to flush master info file"); mysql_mutex_unlock(&mi->data_lock); DBUG_RETURN(error); diff --git a/sql/set_var.cc b/sql/set_var.cc index 617ce2298b1..1c8a2a4d97c 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -668,7 +668,7 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list) if ((error= var->check(thd))) goto err; } - if (!(error= test(thd->is_error()))) + if (!(error= MY_TEST(thd->is_error()))) { it.rewind(); while ((var= it++)) diff --git a/sql/slave.cc b/sql/slave.cc index f281bdf06a2..0e20609814a 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1049,8 +1049,8 @@ static bool sql_slave_killed(rpl_group_info *rgi) DBUG_PRINT("info", ("modified_non_trans_table: %d OPTION_BEGIN: %d " "OPTION_KEEP_LOG: %d is_in_group: %d", thd->transaction.all.modified_non_trans_table, - test(thd->variables.option_bits & OPTION_BEGIN), - test(thd->variables.option_bits & OPTION_KEEP_LOG), + MY_TEST(thd->variables.option_bits & OPTION_BEGIN), + MY_TEST(thd->variables.option_bits & OPTION_KEEP_LOG), rli->is_in_group())); if (rli->abort_slave) @@ -3223,7 +3223,7 @@ int apply_event_and_update_pos(Log_event* ev, THD* thd, "skipped because event skip counter was non-zero" }; DBUG_PRINT("info", ("OPTION_BEGIN: %d IN_STMT: %d IN_TRANSACTION: %d", - test(thd->variables.option_bits & OPTION_BEGIN), + MY_TEST(thd->variables.option_bits & OPTION_BEGIN), rli->get_flag(Relay_log_info::IN_STMT), rli->get_flag(Relay_log_info::IN_TRANSACTION))); DBUG_PRINT("skip_event", ("%s event was %s", diff --git a/sql/sp_head.h b/sql/sp_head.h index 77adbf091b8..c1fb455e103 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -462,9 +462,10 @@ public: else if (m_flags & HAS_SQLCOM_FLUSH) my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "FLUSH"); - return test(m_flags & - (CONTAINS_DYNAMIC_SQL|MULTI_RESULTS|HAS_SET_AUTOCOMMIT_STMT| - HAS_COMMIT_OR_ROLLBACK|HAS_SQLCOM_RESET|HAS_SQLCOM_FLUSH)); + return MY_TEST(m_flags & + (CONTAINS_DYNAMIC_SQL | MULTI_RESULTS | + HAS_SET_AUTOCOMMIT_STMT | HAS_COMMIT_OR_ROLLBACK | + HAS_SQLCOM_RESET | HAS_SQLCOM_FLUSH)); } #ifndef DBUG_OFF diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h index ce692024d0d..c48025da93d 100644 --- a/sql/sp_rcontext.h +++ b/sql/sp_rcontext.h @@ -450,7 +450,7 @@ public: int close(THD *thd); my_bool is_open() - { return test(server_side_cursor); } + { return MY_TEST(server_side_cursor); } int fetch(THD *, List<sp_variable> *vars); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index c35794f476c..f4ddc98521e 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2969,9 +2969,9 @@ static bool update_user_table(THD *thd, TABLE *table, static bool test_if_create_new_users(THD *thd) { Security_context *sctx= thd->security_ctx; - bool create_new_users= test(sctx->master_access & INSERT_ACL) || + bool create_new_users= MY_TEST(sctx->master_access & INSERT_ACL) || (!opt_safe_user_create && - test(sctx->master_access & CREATE_USER_ACL)); + MY_TEST(sctx->master_access & CREATE_USER_ACL)); if (!create_new_users) { TABLE_LIST tl; @@ -5084,7 +5084,8 @@ static int update_role_table_columns(GRANT_TABLE *merged, now those roles were dropped or had their privileges revoked). we need to remove this GRANT_TABLE */ - DBUG_EXECUTE_IF("role_merge_stats", role_column_merges+= test(merged->cols);); + DBUG_EXECUTE_IF("role_merge_stats", + role_column_merges+= MY_TEST(merged->cols);); my_hash_delete(&column_priv_hash,(uchar*) merged); return 4; } @@ -5109,7 +5110,7 @@ static bool merge_role_table_and_column_privileges(ACL_ROLE *grantee, const char *db, const char *tname, role_hash_t *rhash) { Dynamic_array<GRANT_TABLE *> grants; - DBUG_ASSERT(test(db) == test(tname)); // both must be set, or neither + DBUG_ASSERT(MY_TEST(db) == MY_TEST(tname)); // both must be set, or neither /* first, collect table/column privileges granted to @@ -5232,7 +5233,7 @@ static bool merge_role_routine_grant_privileges(ACL_ROLE *grantee, { ulong update_flags= 0; - DBUG_ASSERT(test(db) == test(tname)); // both must be set, or neither + DBUG_ASSERT(MY_TEST(db) == MY_TEST(tname)); // both must be set, or neither DBUG_EXECUTE_IF("role_merge_stats", role_routine_merges++;); @@ -5530,8 +5531,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, else error=replace_user_table(thd, tables[0].table, *Str, 0, revoke_grant, create_new_users, - test(thd->variables.sql_mode & - MODE_NO_AUTO_CREATE_USER)); + MY_TEST(thd->variables.sql_mode & + MODE_NO_AUTO_CREATE_USER)); if (error) { result= TRUE; // Remember error @@ -5738,8 +5739,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, /* Create user if needed */ error=replace_user_table(thd, tables[0].table, *Str, 0, revoke_grant, create_new_users, - test(thd->variables.sql_mode & - MODE_NO_AUTO_CREATE_USER)); + MY_TEST(thd->variables.sql_mode & + MODE_NO_AUTO_CREATE_USER)); if (error) { result= TRUE; // Remember error @@ -5885,7 +5886,8 @@ bool mysql_grant_role(THD *thd, List <LEX_USER> &list, bool revoke) rolename= granted_role->user; create_new_user= test_if_create_new_users(thd); - no_auto_create_user= test(thd->variables.sql_mode & MODE_NO_AUTO_CREATE_USER); + no_auto_create_user= MY_TEST(thd->variables.sql_mode & + MODE_NO_AUTO_CREATE_USER); TABLE_LIST tables[2]; tables[0].init_one_table(C_STRING_WITH_LEN("mysql"), @@ -6203,8 +6205,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, else if (replace_user_table(thd, tables[0].table, *Str, (!db ? rights : 0), revoke_grant, create_new_users, - test(thd->variables.sql_mode & - MODE_NO_AUTO_CREATE_USER))) + MY_TEST(thd->variables.sql_mode & + MODE_NO_AUTO_CREATE_USER))) result= -1; else if (db) { @@ -6633,7 +6635,7 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, for (tl= tables; number-- ; tl= tl->next_global) { - sctx = test(tl->security_ctx) ? tl->security_ctx : thd->security_ctx; + sctx= MY_TEST(tl->security_ctx) ? tl->security_ctx : thd->security_ctx; const ACL_internal_table_access *access= get_cached_table_access(&tl->grant.m_internal, @@ -6888,7 +6890,7 @@ bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref, GRANT_INFO *grant; const char *db_name; const char *table_name; - Security_context *sctx= test(table_ref->security_ctx) ? + Security_context *sctx= MY_TEST(table_ref->security_ctx) ? table_ref->security_ctx : thd->security_ctx; if (table_ref->view || table_ref->field_translation) @@ -11474,7 +11476,7 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio, db + passwd_len + 1 : 0; if (passwd == NULL || - passwd + passwd_len + test(db) > (char *)net->read_pos + pkt_len) + passwd + passwd_len + MY_TEST(db) > (char*) net->read_pos + pkt_len) return packet_error; /* strlen() can't be easily deleted without changing protocol */ diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index d9155b38066..fc506091dea 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -1218,7 +1218,7 @@ bool Sql_cmd_repair_table::execute(THD *thd) thd->enable_slow_log= opt_log_slow_admin_statements; res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "repair", TL_WRITE, 1, - test(m_lex->check_opt.sql_flags & TT_USEFRM), + MY_TEST(m_lex->check_opt.sql_flags & TT_USEFRM), HA_OPEN_FOR_REPAIR, &prepare_for_repair, &handler::ha_repair, 0); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index b0e121018fc..e70b02bec94 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1142,7 +1142,8 @@ bool close_temporary_tables(THD *thd) /* We always quote db,table names though it is slight overkill */ if (found_user_tables && - !(was_quote_show= test(thd->variables.option_bits & OPTION_QUOTE_SHOW_CREATE))) + !(was_quote_show= MY_TEST(thd->variables.option_bits & + OPTION_QUOTE_SHOW_CREATE))) { thd->variables.option_bits |= OPTION_QUOTE_SHOW_CREATE; } @@ -7747,7 +7748,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, thd->lex->allow_sum_func= save_allow_sum_func; thd->mark_used_columns= save_mark_used_columns; DBUG_PRINT("info", ("thd->mark_used_columns: %d", thd->mark_used_columns)); - DBUG_RETURN(test(thd->is_error())); + DBUG_RETURN(MY_TEST(thd->is_error())); } @@ -8448,7 +8449,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List<TABLE_LIST> &leaves, select_lex->where= *conds; } thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; - DBUG_RETURN(test(thd->is_error())); + DBUG_RETURN(MY_TEST(thd->is_error())); err_no_arena: select_lex->is_item_list_lookup= save_is_item_list_lookup; diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h index 2e07695f605..0178844fec4 100644 --- a/sql/sql_bitmap.h +++ b/sql/sql_bitmap.h @@ -61,7 +61,7 @@ public: intersect(map2buff); if (map.n_bits > sizeof(ulonglong) * 8) bitmap_set_above(&map, sizeof(ulonglong), - test(map2buff & (1LL << (sizeof(ulonglong) * 8 - 1)))); + MY_TEST(map2buff & (1LL << (sizeof(ulonglong) * 8 - 1)))); } void subtract(Bitmap& map2) { bitmap_subtract(&map, &map2.map); } void merge(Bitmap& map2) { bitmap_union(&map, &map2.map); } @@ -156,7 +156,7 @@ public: void intersect_extended(ulonglong map2) { map&= map2; } void subtract(Bitmap<64>& map2) { map&= ~map2.map; } void merge(Bitmap<64>& map2) { map|= map2.map; } - bool is_set(uint n) const { return test(map & (((ulonglong)1) << n)); } + bool is_set(uint n) const { return MY_TEST(map & (((ulonglong) 1) << n)); } bool is_prefix(uint n) const { return map == (((ulonglong)1) << n)-1; } bool is_clear_all() const { return map == (ulonglong)0; } bool is_set_all() const { return map == ~(ulonglong)0; } diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 5307f4f01f8..b0327153aa2 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1404,9 +1404,9 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) Query_cache_query_flags flags; // fill all gaps between fields with 0 to get repeatable key bzero(&flags, QUERY_CACHE_FLAGS_SIZE); - flags.client_long_flag= test(thd->client_capabilities & CLIENT_LONG_FLAG); - flags.client_protocol_41= test(thd->client_capabilities & - CLIENT_PROTOCOL_41); + flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG); + flags.client_protocol_41= MY_TEST(thd->client_capabilities & + CLIENT_PROTOCOL_41); /* Protocol influences result format, so statement results in the binary protocol (COM_EXECUTE) cannot be served to statements asking for results @@ -1415,10 +1415,10 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) flags.protocol_type= (unsigned int) thd->protocol->type(); /* PROTOCOL_LOCAL results are not cached. */ DBUG_ASSERT(flags.protocol_type != (unsigned int) Protocol::PROTOCOL_LOCAL); - flags.more_results_exists= test(thd->server_status & - SERVER_MORE_RESULTS_EXISTS); + flags.more_results_exists= MY_TEST(thd->server_status & + SERVER_MORE_RESULTS_EXISTS); flags.in_trans= thd->in_active_multi_stmt_transaction(); - flags.autocommit= test(thd->server_status & SERVER_STATUS_AUTOCOMMIT); + flags.autocommit= MY_TEST(thd->server_status & SERVER_STATUS_AUTOCOMMIT); flags.pkt_nr= net->pkt_nr; flags.character_set_client_num= thd->variables.character_set_client->number; @@ -1899,14 +1899,14 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length) // fill all gaps between fields with 0 to get repeatable key bzero(&flags, QUERY_CACHE_FLAGS_SIZE); - flags.client_long_flag= test(thd->client_capabilities & CLIENT_LONG_FLAG); - flags.client_protocol_41= test(thd->client_capabilities & - CLIENT_PROTOCOL_41); + flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG); + flags.client_protocol_41= MY_TEST(thd->client_capabilities & + CLIENT_PROTOCOL_41); flags.protocol_type= (unsigned int) thd->protocol->type(); - flags.more_results_exists= test(thd->server_status & - SERVER_MORE_RESULTS_EXISTS); + flags.more_results_exists= MY_TEST(thd->server_status & + SERVER_MORE_RESULTS_EXISTS); flags.in_trans= thd->in_active_multi_stmt_transaction(); - flags.autocommit= test(thd->server_status & SERVER_STATUS_AUTOCOMMIT); + flags.autocommit= MY_TEST(thd->server_status & SERVER_STATUS_AUTOCOMMIT); flags.pkt_nr= thd->net.pkt_nr; flags.character_set_client_num= thd->variables.character_set_client->number; flags.character_set_results_num= @@ -3409,7 +3409,7 @@ my_bool Query_cache::register_all_tables(THD *thd, if (block_table->parent) unlink_table(block_table); } - return test(n); + return MY_TEST(n); } @@ -4109,7 +4109,7 @@ Query_cache::is_cacheable(THD *thd, LEX *lex, (long) OPTION_TO_QUERY_CACHE, (long) lex->select_lex.options, (int) thd->variables.query_cache_type, - (uint) test(qc_is_able_to_intercept_result(thd)))); + (uint) MY_TEST(qc_is_able_to_intercept_result(thd)))); DBUG_RETURN(0); } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index af908c0e71f..2be1b895f39 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -515,14 +515,14 @@ extern "C" int mysql_tmpfile(const char *prefix) extern "C" int thd_in_lock_tables(const THD *thd) { - return test(thd->in_lock_tables); + return MY_TEST(thd->in_lock_tables); } extern "C" int thd_tablespace_op(const THD *thd) { - return test(thd->tablespace_op); + return MY_TEST(thd->tablespace_op); } extern "C" @@ -2605,7 +2605,7 @@ void select_to_file::send_error(uint errcode,const char *err) bool select_to_file::send_eof() { - int error= test(end_io_cache(&cache)); + int error= MY_TEST(end_io_cache(&cache)); if (mysql_file_close(file, MYF(MY_WME)) || thd->is_error()) error= true; @@ -2786,8 +2786,8 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u) escape_char= (int) (uchar) (*exchange->escaped)[0]; else escape_char= -1; - is_ambiguous_field_sep= test(strchr(ESCAPE_CHARS, field_sep_char)); - is_unsafe_field_sep= test(strchr(NUMERIC_CHARS, field_sep_char)); + is_ambiguous_field_sep= MY_TEST(strchr(ESCAPE_CHARS, field_sep_char)); + is_unsafe_field_sep= MY_TEST(strchr(NUMERIC_CHARS, field_sep_char)); line_sep_char= (exchange->line_term->length() ? (int) (uchar) (*exchange->line_term)[0] : INT_MAX); if (!field_term_length) diff --git a/sql/sql_class.h b/sql/sql_class.h index 81040624353..defc31547d0 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4448,7 +4448,7 @@ public: table.str= internal_table_name; table.length=1; } - bool is_derived_table() const { return test(sel); } + bool is_derived_table() const { return MY_TEST(sel); } inline void change_db(char *db_name) { db.str= db_name; db.length= (uint) strlen(db_name); diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 1500f1615fb..b92a4cd23f6 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -140,7 +140,7 @@ void Update_plan::save_explain_data_intern(Explain_query *query, explain->jtype= JT_NEXT; } - explain->using_where= test(select && select->cond); + explain->using_where= MY_TEST(select && select->cond); explain->using_filesort= using_filesort; explain->using_io_buffer= using_io_buffer; @@ -252,7 +252,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, table->map=1; query_plan.select_lex= &thd->lex->select_lex; query_plan.table= table; - query_plan.updating_a_view= test(table_list->view); + query_plan.updating_a_view= MY_TEST(table_list->view); if (mysql_prepare_delete(thd, table_list, select_lex->with_wild, select_lex->item_list, &conds)) @@ -291,7 +291,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, DBUG_RETURN(TRUE); const_cond= (!conds || conds->const_item()); - safe_update=test(thd->variables.option_bits & OPTION_SAFE_UPDATES); + safe_update= MY_TEST(thd->variables.option_bits & OPTION_SAFE_UPDATES); if (safe_update && const_cond) { my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index dee631edb4b..3e7091e8925 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -660,7 +660,7 @@ static void save_insert_query_plan(THD* thd, TABLE_LIST *table_list) thd->lex->explain->add_insert_plan(explain); /* See Update_plan::updating_a_view for details */ - bool skip= test(table_list->view); + bool skip= MY_TEST(table_list->view); /* Save subquery children */ for (SELECT_LEX_UNIT *unit= thd->lex->select_lex.first_inner_unit(); @@ -1933,7 +1933,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry, if (table_list) { table_list= table_list->top_table(); - view= test(table_list->view); + view= MY_TEST(table_list->view); } if (view) { @@ -4211,8 +4211,8 @@ select_create::binlog_show_create_table(TABLE **tables, uint count) result= store_create_info(thd, &tmp_table_list, &query, create_info, /* show_database */ TRUE, - test(create_info->options & - HA_LEX_CREATE_REPLACE)); + MY_TEST(create_info->options & + HA_LEX_CREATE_REPLACE)); DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */ if (mysql_bin_log.is_open()) diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index 3b39ebf145f..abd23c344c2 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -222,8 +222,8 @@ void JOIN_CACHE::calc_record_fields() for (; tab != join_tab ; tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS)) { tab->calc_used_field_length(FALSE); - flag_fields+= test(tab->used_null_fields || tab->used_uneven_bit_fields); - flag_fields+= test(tab->table->maybe_null); + flag_fields+= MY_TEST(tab->used_null_fields || tab->used_uneven_bit_fields); + flag_fields+= MY_TEST(tab->table->maybe_null); fields+= tab->used_fields; blobs+= tab->used_blobs; } @@ -736,7 +736,7 @@ void JOIN_CACHE::set_constants() uint JOIN_CACHE::get_record_max_affix_length() { uint len= get_prefix_length() + - test(with_match_flag) + + MY_TEST(with_match_flag) + size_of_fld_ofs * data_field_count; return len; } @@ -1012,7 +1012,7 @@ int JOIN_CACHE::realloc_buffer() { int rc; free(); - rc= test(!(buff= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC)))); + rc= MY_TEST(!(buff= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC)))); reset(TRUE); return rc; } @@ -1766,7 +1766,7 @@ uint JOIN_CACHE::read_flag_fields() CACHE_FIELD *copy_end= copy+flag_fields; if (with_match_flag) { - copy->str[0]= test((Match_flag) pos[0] == MATCH_FOUND); + copy->str[0]= MY_TEST((Match_flag) pos[0] == MATCH_FOUND); pos+= copy->length; copy++; } @@ -2520,7 +2520,7 @@ enum_nested_loop_state JOIN_CACHE::join_null_complements(bool skip_last) if (!records) DBUG_RETURN(NESTED_LOOP_OK); - cnt= records - (is_key_access() ? 0 : test(skip_last)); + cnt= records - (is_key_access() ? 0 : MY_TEST(skip_last)); /* This function may be called only for inner tables of outer joins */ DBUG_ASSERT(join_tab->first_inner); @@ -2570,7 +2570,7 @@ finish: void JOIN_CACHE::save_explain_data(struct st_explain_bka_type *explain) { - explain->incremental= test(prev_cache); + explain->incremental= MY_TEST(prev_cache); switch (get_join_alg()) { case BNL_JOIN_ALG: @@ -2792,7 +2792,7 @@ int JOIN_CACHE_HASHED::realloc_buffer() { int rc; free(); - rc= test(!(buff= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC)))); + rc= MY_TEST(!(buff= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC)))); init_hash_table(); reset(TRUE); return rc; @@ -3472,7 +3472,7 @@ bool JOIN_CACHE_BNL::prepare_look_for_matches(bool skip_last) if (!records) return TRUE; reset(FALSE); - rem_records= records-test(skip_last); + rem_records= records - MY_TEST(skip_last); return rem_records == 0; } @@ -4588,7 +4588,7 @@ int JOIN_CACHE_BKAH::init() { bool check_only_first_match= join_tab->check_only_first_match(); - no_association= test(mrr_mode & HA_MRR_NO_ASSOCIATION); + no_association= MY_TEST(mrr_mode & HA_MRR_NO_ASSOCIATION); RANGE_SEQ_IF rs_funcs= { bka_range_seq_key_info, bkah_range_seq_init, diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7096c886281..c549a7be2cc 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -299,7 +299,7 @@ Lex_input_stream::reset(char *buffer, unsigned int length) m_cpp_utf8_processed_ptr= NULL; next_state= MY_LEX_START; found_semicolon= NULL; - ignore_space= test(m_thd->variables.sql_mode & MODE_IGNORE_SPACE); + ignore_space= MY_TEST(m_thd->variables.sql_mode & MODE_IGNORE_SPACE); stmt_prepare_mode= FALSE; multi_statements= TRUE; in_comment=NO_COMMENT; @@ -3073,7 +3073,7 @@ TABLE_LIST *LEX::unlink_first_table(bool *link_to_local) /* and from local list if it is not empty */ - if ((*link_to_local= test(select_lex.table_list.first))) + if ((*link_to_local= MY_TEST(select_lex.table_list.first))) { select_lex.context.table_list= select_lex.context.first_name_resolution_table= first->next_local; @@ -3824,7 +3824,7 @@ void SELECT_LEX::update_used_tables() do { bool maybe_null; - if ((maybe_null= test(embedding->outer_join))) + if ((maybe_null= MY_TEST(embedding->outer_join))) { tl->table->maybe_null= maybe_null; break; @@ -3901,37 +3901,40 @@ void st_select_lex::update_correlated_cache() while ((tl= ti++)) { if (tl->on_expr) - is_correlated|= test(tl->on_expr->used_tables() & OUTER_REF_TABLE_BIT); + is_correlated|= MY_TEST(tl->on_expr->used_tables() & OUTER_REF_TABLE_BIT); for (TABLE_LIST *embedding= tl->embedding ; embedding ; embedding= embedding->embedding) { if (embedding->on_expr) - is_correlated|= test(embedding->on_expr->used_tables() & - OUTER_REF_TABLE_BIT); + is_correlated|= MY_TEST(embedding->on_expr->used_tables() & + OUTER_REF_TABLE_BIT); } } if (join->conds) - is_correlated|= test(join->conds->used_tables() & OUTER_REF_TABLE_BIT); + is_correlated|= MY_TEST(join->conds->used_tables() & OUTER_REF_TABLE_BIT); if (join->having) - is_correlated|= test(join->having->used_tables() & OUTER_REF_TABLE_BIT); + is_correlated|= MY_TEST(join->having->used_tables() & OUTER_REF_TABLE_BIT); if (join->tmp_having) - is_correlated|= test(join->tmp_having->used_tables() & OUTER_REF_TABLE_BIT); + is_correlated|= MY_TEST(join->tmp_having->used_tables() & + OUTER_REF_TABLE_BIT); Item *item; List_iterator_fast<Item> it(join->fields_list); while ((item= it++)) - is_correlated|= test(item->used_tables() & OUTER_REF_TABLE_BIT); + is_correlated|= MY_TEST(item->used_tables() & OUTER_REF_TABLE_BIT); for (ORDER *order= group_list.first; order; order= order->next) - is_correlated|= test((*order->item)->used_tables() & OUTER_REF_TABLE_BIT); + is_correlated|= MY_TEST((*order->item)->used_tables() & + OUTER_REF_TABLE_BIT); if (!master_unit()->is_union()) { for (ORDER *order= order_list.first; order; order= order->next) - is_correlated|= test((*order->item)->used_tables() & OUTER_REF_TABLE_BIT); + is_correlated|= MY_TEST((*order->item)->used_tables() & + OUTER_REF_TABLE_BIT); } if (!is_correlated) @@ -4220,7 +4223,7 @@ int st_select_lex_unit::save_union_explain(Explain_query *output) eu->add_select(sl->select_number); eu->fake_select_type= "UNION RESULT"; - eu->using_filesort= test(global_parameters->order_list.first); + eu->using_filesort= MY_TEST(global_parameters->order_list.first); // Save the UNION node output->add_node(eu); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index b84aea6c140..13cbcdd9f08 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1152,7 +1152,7 @@ public: } bool requires_prelocking() { - return test(query_tables_own_last); + return MY_TEST(query_tables_own_last); } void mark_as_requiring_prelocking(TABLE_LIST **tables_own_last) { diff --git a/sql/sql_load.cc b/sql/sql_load.cc index a0959bdd278..d112b3e689a 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -462,7 +462,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, } thd_proc_info(thd, "reading file"); - if (!(error=test(read_info.error))) + if (!(error= MY_TEST(read_info.error))) { table->next_number_field=table->found_next_number_field; if (ignore || @@ -905,7 +905,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, thd->get_stmt_da()->inc_current_row_for_warning(); continue_loop:; } - DBUG_RETURN(test(read_info.error)); + DBUG_RETURN(MY_TEST(read_info.error)); } @@ -1130,7 +1130,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, thd->get_stmt_da()->inc_current_row_for_warning(); continue_loop:; } - DBUG_RETURN(test(read_info.error)); + DBUG_RETURN(MY_TEST(read_info.error)); } @@ -1298,7 +1298,7 @@ read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, thd->get_stmt_da()->inc_current_row_for_warning(); continue_loop:; } - DBUG_RETURN(test(read_info.error) || thd->is_error()); + DBUG_RETURN(MY_TEST(read_info.error) || thd->is_error()); } /* load xml end */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 0de3609e932..30448266f4e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2416,8 +2416,8 @@ mysql_execute_command(THD *thd) #endif status_var_increment(thd->status_var.com_stat[lex->sql_command]); - thd->progress.report_to_client= test(sql_command_flags[lex->sql_command] & - CF_REPORT_PROGRESS); + thd->progress.report_to_client= MY_TEST(sql_command_flags[lex->sql_command] & + CF_REPORT_PROGRESS); DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == FALSE); @@ -3500,7 +3500,7 @@ end_with_restore_list: case SQLCOM_INSERT_SELECT: { select_result *sel_result; - bool explain= test(lex->describe); + bool explain= MY_TEST(lex->describe); DBUG_ASSERT(first_table == all_tables && first_table != 0); if ((res= insert_precheck(thd, all_tables))) break; @@ -3614,7 +3614,7 @@ end_with_restore_list: { DBUG_ASSERT(first_table == all_tables && first_table != 0); TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first; - bool explain= test(lex->describe); + bool explain= MY_TEST(lex->describe); multi_delete *result; if ((res= multi_delete_precheck(thd, all_tables))) @@ -6708,7 +6708,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, if (!table) DBUG_RETURN(0); // End of memory alias_str= alias ? alias->str : table->table.str; - if (!test(table_options & TL_OPTION_ALIAS) && + if (!MY_TEST(table_options & TL_OPTION_ALIAS) && check_table_name(table->table.str, table->table.length, FALSE)) { my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str); @@ -6753,10 +6753,10 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ptr->table_name=table->table.str; ptr->table_name_length=table->table.length; ptr->lock_type= lock_type; - ptr->updating= test(table_options & TL_OPTION_UPDATING); + ptr->updating= MY_TEST(table_options & TL_OPTION_UPDATING); /* TODO: remove TL_OPTION_FORCE_INDEX as it looks like it's not used */ - ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX); - ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES); + ptr->force_index= MY_TEST(table_options & TL_OPTION_FORCE_INDEX); + ptr->ignore_leaves= MY_TEST(table_options & TL_OPTION_IGNORE_LEAVES); ptr->derived= table->sel; if (!ptr->derived && is_infoschema_db(ptr->db, ptr->db_length)) { @@ -6851,7 +6851,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, lex->add_to_query_tables(ptr); // Pure table aliases do not need to be locked: - if (!test(table_options & TL_OPTION_ALIAS)) + if (!MY_TEST(table_options & TL_OPTION_ALIAS)) { ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type, MDL_TRANSACTION); diff --git a/sql/sql_parse.h b/sql/sql_parse.h index 1545edeaa8a..926a4d800ad 100644 --- a/sql/sql_parse.h +++ b/sql/sql_parse.h @@ -200,7 +200,7 @@ bool check_global_access(THD *thd, ulong want_access, bool no_errors= false); inline bool is_supported_parser_charset(CHARSET_INFO *cs) { - return test(cs->mbminlen == 1); + return MY_TEST(cs->mbminlen == 1); } diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 782a49af813..a9846df3b02 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -3308,7 +3308,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info, } else { - DBUG_RETURN(list_index + test(left_endpoint ^ include_endpoint)); + DBUG_RETURN(list_index + MY_TEST(left_endpoint ^ include_endpoint)); } } while (max_list_index >= min_list_index); notfound: @@ -5783,7 +5783,7 @@ static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt) if (mysql_trans_commit_alter_copy_data(thd)) error= 1; /* The error has been reported */ - DBUG_RETURN(test(error)); + DBUG_RETURN(MY_TEST(error)); } @@ -7892,7 +7892,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, index-in-ordered-array-of-list-constants (for LIST) space. */ store_key_image_to_rec(field, min_value, field_len); - bool include_endp= !test(flags & NEAR_MIN); + bool include_endp= !MY_TEST(flags & NEAR_MIN); part_iter->part_nums.start= get_endpoint(part_info, 1, include_endp); if (!can_match_multiple_values && part_info->part_expr->null_value) { @@ -7927,7 +7927,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, else { store_key_image_to_rec(field, max_value, field_len); - bool include_endp= !test(flags & NEAR_MAX); + bool include_endp= !MY_TEST(flags & NEAR_MAX); part_iter->part_nums.end= get_endpoint(part_info, 0, include_endp); if (check_zero_dates && !zero_in_start_date && @@ -8094,8 +8094,8 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info, if ((ulonglong)b - (ulonglong)a == ~0ULL) DBUG_RETURN(-1); - a += test(flags & NEAR_MIN); - b += test(!(flags & NEAR_MAX)); + a+= MY_TEST(flags & NEAR_MIN); + b+= MY_TEST(!(flags & NEAR_MAX)); ulonglong n_values= b - a; /* diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 1450d5c03ea..6ca4015adb4 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -978,7 +978,7 @@ static bool setup_conversion_functions(Prepared_statement *stmt, typecode= sint2korr(read_pos); read_pos+= 2; - (**it).unsigned_flag= test(typecode & signed_bit); + (**it).unsigned_flag= MY_TEST(typecode & signed_bit); setup_one_conversion_function(thd, *it, (uchar) (typecode & ~signed_bit)); } } @@ -2716,7 +2716,7 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length) DBUG_PRINT("exec_query", ("%s", stmt->query())); DBUG_PRINT("info",("stmt: 0x%lx", (long) stmt)); - open_cursor= test(flags & (ulong) CURSOR_TYPE_READ_ONLY); + open_cursor= MY_TEST(flags & (ulong) CURSOR_TYPE_READ_ONLY); thd->protocol= &thd->protocol_binary; stmt->execute_loop(&expanded_query, open_cursor, packet, packet_end); diff --git a/sql/sql_prepare.h b/sql/sql_prepare.h index ea5ebddb561..b468ac1bf9b 100644 --- a/sql/sql_prepare.h +++ b/sql/sql_prepare.h @@ -290,7 +290,7 @@ public: one. Never fails. */ - bool has_next_result() const { return test(m_current_rset->m_next_rset); } + bool has_next_result() const { return MY_TEST(m_current_rset->m_next_rset); } /** Only valid to call if has_next_result() returned true. Otherwise the result is undefined. @@ -298,7 +298,7 @@ public: bool move_to_next_result() { m_current_rset= m_current_rset->m_next_rset; - return test(m_current_rset); + return MY_TEST(m_current_rset); } ~Ed_connection() { free_old_result(); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 332230e67dc..6ed3791b205 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1766,7 +1766,7 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S /* Perform FULLTEXT search before all regular searches */ if (!(select_options & SELECT_DESCRIBE)) - init_ftfuncs(thd, select_lex, test(order)); + init_ftfuncs(thd, select_lex, MY_TEST(order)); if (optimize_unflattened_subqueries()) DBUG_RETURN(1); @@ -2279,7 +2279,7 @@ JOIN::reinit() } if (!(select_options & SELECT_DESCRIBE)) - init_ftfuncs(thd, select_lex, test(order)); + init_ftfuncs(thd, select_lex, MY_TEST(order)); DBUG_RETURN(0); } @@ -2602,7 +2602,7 @@ void JOIN::exec_inner() curr_join->const_tables != curr_join->table_count) { JOIN_TAB *first_tab= curr_join->join_tab + curr_join->const_tables; - first_tab->sorted= test(first_tab->loosescan_match_tab); + first_tab->sorted= MY_TEST(first_tab->loosescan_match_tab); } Procedure *save_proc= curr_join->procedure; @@ -2782,7 +2782,7 @@ void JOIN::exec_inner() curr_join->const_tables != curr_join->table_count) { JOIN_TAB *first_tab= curr_join->join_tab + curr_join->const_tables; - first_tab->sorted= test(first_tab->loosescan_match_tab); + first_tab->sorted= MY_TEST(first_tab->loosescan_match_tab); } tmp_error= -1; if (setup_sum_funcs(curr_join->thd, curr_join->sum_funcs) || @@ -4982,8 +4982,8 @@ sort_keyuse(KEYUSE *a,KEYUSE *b) if (a->keypart != b->keypart) return (int) (a->keypart - b->keypart); // Place const values before other ones - if ((res= test((a->used_tables & ~OUTER_REF_TABLE_BIT)) - - test((b->used_tables & ~OUTER_REF_TABLE_BIT)))) + if ((res= MY_TEST((a->used_tables & ~OUTER_REF_TABLE_BIT)) - + MY_TEST((b->used_tables & ~OUTER_REF_TABLE_BIT)))) return res; /* Place rows that are not 'OPTIMIZE_REF_OR_NULL' first */ return (int) ((a->optimize & KEY_OPTIMIZE_REF_OR_NULL) - @@ -5766,7 +5766,7 @@ best_access_path(JOIN *join, } else { - found_constraint= test(found_part); + found_constraint= MY_TEST(found_part); loose_scan_opt.check_ref_access_part1(s, key, start_key, found_part); /* Check if we found full key */ @@ -5775,7 +5775,7 @@ best_access_path(JOIN *join, { /* use eq key */ max_key_part= (uint) ~0; if ((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME || - test(key_flags & HA_EXT_NOSAME)) + MY_TEST(key_flags & HA_EXT_NOSAME)) { tmp = prev_record_reads(join->positions, idx, found_ref); records=1.0; @@ -5906,7 +5906,7 @@ best_access_path(JOIN *join, */ if (table->quick_keys.is_set(key) && !found_ref && //(C1) table->quick_key_parts[key] == max_key_part && //(C2) - table->quick_n_ranges[key] == 1+test(ref_or_null_part)) //(C3) + table->quick_n_ranges[key] == 1 + MY_TEST(ref_or_null_part)) //(C3) { tmp= records= (double) table->quick_rows[key]; } @@ -6000,8 +6000,8 @@ best_access_path(JOIN *join, table->quick_key_parts[key] <= max_key_part && const_part & ((key_part_map)1 << table->quick_key_parts[key]) && - table->quick_n_ranges[key] == 1 + test(ref_or_null_part & - const_part) && + table->quick_n_ranges[key] == 1 + MY_TEST(ref_or_null_part & + const_part) && records > (double) table->quick_rows[key]) { tmp= records= (double) table->quick_rows[key]; @@ -6192,8 +6192,8 @@ best_access_path(JOIN *join, best_key= 0; /* range/index_merge/ALL/index access method are "independent", so: */ best_ref_depends_map= 0; - best_uses_jbuf= test(!disable_jbuf && !((s->table->map & - join->outer_join))); + best_uses_jbuf= MY_TEST(!disable_jbuf && !((s->table->map & + join->outer_join))); } } @@ -6358,7 +6358,7 @@ choose_plan(JOIN *join, table_map join_tables) uint prune_level= join->thd->variables.optimizer_prune_level; uint use_cond_selectivity= join->thd->variables.optimizer_use_condition_selectivity; - bool straight_join= test(join->select_options & SELECT_STRAIGHT_JOIN); + bool straight_join= MY_TEST(join->select_options & SELECT_STRAIGHT_JOIN); DBUG_ENTER("choose_plan"); join->cur_embedding_map= 0; @@ -8482,7 +8482,7 @@ static bool are_tables_local(JOIN_TAB *jtab, table_map used_tables) table_map local_tables= jtab->emb_sj_nest->nested_join->used_tables | jtab->join->const_table_map | OUTER_REF_TABLE_BIT; - return !test(used_tables & ~local_tables); + return !MY_TEST(used_tables & ~local_tables); } /* @@ -8619,7 +8619,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, !are_tables_local(j, keyuse->val->used_tables())) keyuse++; /* Skip other parts */ - uint maybe_null= test(keyinfo->key_part[i].null_bit); + uint maybe_null= MY_TEST(keyinfo->key_part[i].null_bit); j->ref.items[i]=keyuse->val; // Save for cond removal j->ref.cond_guards[i]= keyuse->cond_guard; if (keyuse->null_rejecting) @@ -8673,7 +8673,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, else if (!((keyparts == keyinfo->user_defined_key_parts && ((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)) || (keyparts > keyinfo->user_defined_key_parts && // true only for extended keys - test(key_flags & HA_EXT_NOSAME) && + MY_TEST(key_flags & HA_EXT_NOSAME) && keyparts == keyinfo->ext_key_parts)) || null_ref_key) { @@ -8796,7 +8796,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *temp_table) functions are handled. */ // the temporary table was explicitly requested - DBUG_ASSERT(test(select_options & OPTION_BUFFER_RESULT)); + DBUG_ASSERT(MY_TEST(select_options & OPTION_BUFFER_RESULT)); // the temporary table does not have a grouping expression DBUG_ASSERT(!temp_table->group); } @@ -10403,7 +10403,7 @@ uint check_join_cache_usage(JOIN_TAB *tab, ((options & SELECT_DESCRIBE) || !tab->cache->init())) { tab->icp_other_tables_ok= FALSE; - return (2-test(!prev_cache)); + return (2 - MY_TEST(!prev_cache)); } goto no_join_cache; case JT_SYSTEM: @@ -10438,7 +10438,7 @@ uint check_join_cache_usage(JOIN_TAB *tab, ((options & SELECT_DESCRIBE) || !tab->cache->init())) { tab->icp_other_tables_ok= FALSE; - return (4-test(!prev_cache)); + return (4 - MY_TEST(!prev_cache)); } goto no_join_cache; } @@ -10457,7 +10457,7 @@ uint check_join_cache_usage(JOIN_TAB *tab, prev_cache= 0; if ((tab->cache= new JOIN_CACHE_BKA(join, tab, flags, prev_cache)) && ((options & SELECT_DESCRIBE) || !tab->cache->init())) - return (6-test(!prev_cache)); + return (6 - MY_TEST(!prev_cache)); goto no_join_cache; } else @@ -10468,7 +10468,7 @@ uint check_join_cache_usage(JOIN_TAB *tab, ((options & SELECT_DESCRIBE) || !tab->cache->init())) { tab->idx_cond_fact_out= FALSE; - return (8-test(!prev_cache)); + return (8 - MY_TEST(!prev_cache)); } goto no_join_cache; } @@ -10563,7 +10563,7 @@ restart: no_jbuf_after, idx, prev_tab); - tab->use_join_cache= test(tab->used_join_cache_level); + tab->use_join_cache= MY_TEST(tab->used_join_cache_level); /* psergey-merge: todo: raise the question that this is really stupid that we can first allocate a join buffer, then decide not to use it and free @@ -10693,7 +10693,7 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after) uint i; DBUG_ENTER("make_join_readinfo"); - bool statistics= test(!(join->select_options & SELECT_DESCRIBE)); + bool statistics= MY_TEST(!(join->select_options & SELECT_DESCRIBE)); bool sorted= 1; join->complex_firstmatch_tables= table_map(0); @@ -11191,7 +11191,7 @@ bool JOIN_TAB::preread_init() /* init ftfuns for just initialized derived table */ if (table->fulltext_searched) - init_ftfuncs(join->thd, join->select_lex, test(join->order)); + init_ftfuncs(join->thd, join->select_lex, MY_TEST(join->order)); return FALSE; } @@ -11247,12 +11247,12 @@ bool TABLE_REF::tmp_table_index_lookup_init(THD *thd, Item *item= it.next(); DBUG_ASSERT(item); items[i]= item; - int null_count= test(cur_key_part->field->real_maybe_null()); + int null_count= MY_TEST(cur_key_part->field->real_maybe_null()); *ref_key= new store_key_item(thd, cur_key_part->field, /* TIMOUR: the NULL byte is taken into account in cur_key_part->store_length, so instead of - cur_ref_buff + test(maybe_null), we could + cur_ref_buff + MY_TEST(maybe_null), we could use that information instead. */ cur_ref_buff + null_count, @@ -12983,7 +12983,7 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels, item= NULL; /* Don't produce equality */ } - bool produce_equality= test(item == field_item); + bool produce_equality= MY_TEST(item == field_item); if (!item_const && field_sjm && field_sjm != current_sjm) { /* Entering an SJM nest */ @@ -13601,7 +13601,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top, NESTED_JOIN *nested_join; TABLE_LIST *prev_table= 0; List_iterator<TABLE_LIST> li(*join_list); - bool straight_join= test(join->select_options & SELECT_STRAIGHT_JOIN); + bool straight_join= MY_TEST(join->select_options & SELECT_STRAIGHT_JOIN); DBUG_ENTER("simplify_joins"); /* @@ -14224,7 +14224,7 @@ optimize_cond(JOIN *join, COND *conds, DBUG_EXECUTE("where", print_where(conds, "original", QT_ORDINARY);); conds= build_equal_items(join, conds, NULL, join_list, ignore_on_conds, cond_equal, - test(flags & OPT_LINK_EQUAL_FIELDS)); + MY_TEST(flags & OPT_LINK_EQUAL_FIELDS)); DBUG_EXECUTE("where",print_where(conds,"after equal_items", QT_ORDINARY);); /* change field = field to field = const for each found field = const */ @@ -15446,7 +15446,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, ("table_alias: '%s' distinct: %d save_sum_fields: %d " "rows_limit: %lu group: %d", table_alias, (int) distinct, (int) save_sum_fields, - (ulong) rows_limit,test(group))); + (ulong) rows_limit, MY_TEST(group))); thd->inc_status_created_tmp_tables(); thd->query_plan_flags|= QPLAN_TMP_TABLE; @@ -15992,7 +15992,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, table->group=group; /* Table is grouped by key */ param->group_buff=group_buff; share->keys=1; - share->uniques= test(using_unique_constraint); + share->uniques= MY_TEST(using_unique_constraint); table->key_info= table->s->key_info= keyinfo; table->keys_in_use_for_query.set_bit(0); share->keys_in_use.set_bit(0); @@ -16046,7 +16046,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, if (!(cur_group->field= field->new_key_field(thd->mem_root,table, group_buff + - test(maybe_null), + MY_TEST(maybe_null), field->null_ptr, field->null_bit))) goto err; /* purecov: inspected */ @@ -16102,7 +16102,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, null_pack_length-=hidden_null_pack_length; keyinfo->user_defined_key_parts= ((field_count-param->hidden_field_count)+ - (share->uniques ? test(null_pack_length) : 0)); + (share->uniques ? MY_TEST(null_pack_length) : 0)); keyinfo->ext_key_parts= keyinfo->user_defined_key_parts; table->distinct= 1; share->keys= 1; @@ -17514,7 +17514,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab, if (select_cond) { - select_cond_result= test(select_cond->val_int()); + select_cond_result= MY_TEST(select_cond->val_int()); /* check for errors evaluating the condition */ if (join->thd->is_error()) @@ -17899,7 +17899,7 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos) (*tab->on_expr_ref)->update_used_tables(); DBUG_ASSERT((*tab->on_expr_ref)->const_item()); #endif - if ((table->null_row= test((*tab->on_expr_ref)->val_int() == 0))) + if ((table->null_row= MY_TEST((*tab->on_expr_ref)->val_int() == 0))) mark_as_null_row(table); } if (!table->null_row) @@ -21353,7 +21353,7 @@ test_if_subpart(ORDER *a,ORDER *b) else return 0; } - return test(!b); + return MY_TEST(!b); } /** diff --git a/sql/sql_select.h b/sql/sql_select.h index bd0433eb5ee..0262493365b 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -524,7 +524,7 @@ typedef struct st_join_table { ha_rows get_examined_rows(); bool preread_init(); - bool is_sjm_nest() { return test(bush_children); } + bool is_sjm_nest() { return MY_TEST(bush_children); } bool access_from_tables_is_allowed(table_map used_tables, table_map sjm_lookup_tables) @@ -1299,7 +1299,7 @@ public: lock= thd_arg->lock; select_lex= 0; //for safety tmp_join= 0; - select_distinct= test(select_options & SELECT_DISTINCT); + select_distinct= MY_TEST(select_options & SELECT_DISTINCT); no_order= 0; simple_order= 0; simple_group= 0; @@ -1443,7 +1443,7 @@ public: void set_allowed_join_cache_types(); bool is_allowed_hash_join_access() { - return test(allowed_join_cache_types & JOIN_CACHE_HASHED_BIT) && + return MY_TEST(allowed_join_cache_types & JOIN_CACHE_HASHED_BIT) && max_allowed_join_cache_level > JOIN_CACHE_HASHED_BIT; } /* @@ -1462,7 +1462,7 @@ public: return ((const_tables != table_count && ((select_distinct || !simple_order || !simple_group) || (group_list && order) || - test(select_options & OPTION_BUFFER_RESULT))) || + MY_TEST(select_options & OPTION_BUFFER_RESULT))) || (rollup.state != ROLLUP::STATE_NONE && select_distinct)); } bool choose_subquery_plan(table_map join_tables); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 738384d599f..848df7d11f9 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -885,7 +885,7 @@ public: m_view_access_denied_message_ptr(NULL) { - m_sctx = test(m_top_view->security_ctx) ? + m_sctx= MY_TEST(m_top_view->security_ctx) ? m_top_view->security_ctx : thd->security_ctx; } @@ -2011,7 +2011,7 @@ static void store_key_options(THD *thd, String *packet, TABLE *table, end= longlong10_to_str(key_info->block_size, buff, 10); packet->append(buff, (uint) (end - buff)); } - DBUG_ASSERT(test(key_info->flags & HA_USES_COMMENT) == + DBUG_ASSERT(MY_TEST(key_info->flags & HA_USES_COMMENT) == (key_info->comment.length > 0)); if (key_info->flags & HA_USES_COMMENT) { @@ -2398,7 +2398,7 @@ int select_result_explain_buffer::send_data(List<Item> &items) fill_record(thd, dst_table, dst_table->field, items, TRUE, FALSE); res= dst_table->file->ha_write_tmp_row(dst_table->record[0]); set_current_thd(cur_thd); - DBUG_RETURN(test(res)); + DBUG_RETURN(MY_TEST(res)); } bool select_result_text_buffer::send_result_set_metadata(List<Item> &fields, uint flag) @@ -5433,7 +5433,7 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, #ifndef NO_EMBEDDED_ACCESS_CHECKS uint col_access; check_access(thd,SELECT_ACL, db_name->str, - &tables->grant.privilege, 0, 0, test(tables->schema_table)); + &tables->grant.privilege, 0, 0, MY_TEST(tables->schema_table)); col_access= get_column_grant(thd, &tables->grant, db_name->str, table_name->str, field->field_name) & COL_ACLS; @@ -5572,13 +5572,13 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, table->field[1]->store(option_name, strlen(option_name), scs); table->field[2]->store(plugin_decl(plugin)->descr, strlen(plugin_decl(plugin)->descr), scs); - tmp= &yesno[test(hton->commit)]; + tmp= &yesno[MY_TEST(hton->commit)]; table->field[3]->store(tmp->str, tmp->length, scs); table->field[3]->set_notnull(); - tmp= &yesno[test(hton->prepare)]; + tmp= &yesno[MY_TEST(hton->prepare)]; table->field[4]->store(tmp->str, tmp->length, scs); table->field[4]->set_notnull(); - tmp= &yesno[test(hton->savepoint_set)]; + tmp= &yesno[MY_TEST(hton->savepoint_set)]; table->field[5]->store(tmp->str, tmp->length, scs); table->field[5]->set_notnull(); @@ -6145,7 +6145,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables, else table->field[14]->store("", 0, cs); table->field[14]->set_notnull(); - DBUG_ASSERT(test(key_info->flags & HA_USES_COMMENT) == + DBUG_ASSERT(MY_TEST(key_info->flags & HA_USES_COMMENT) == (key_info->comment.length > 0)); if (key_info->flags & HA_USES_COMMENT) table->field[15]->store(key_info->comment.str, diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h index c1c80921861..68aacd69d98 100644 --- a/sql/sql_statistics.h +++ b/sql/sql_statistics.h @@ -354,7 +354,7 @@ public: bool is_null(uint stat_field_no) { - return test(column_stat_nulls & (1 << stat_field_no)); + return MY_TEST(column_stat_nulls & (1 << stat_field_no)); } double get_nulls_ratio() diff --git a/sql/sql_table.cc b/sql/sql_table.cc index c94343cadfd..3b6e432e8a2 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3802,7 +3802,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, with length (unlike blobs, where ft code takes data length from a data prefix, ignoring column->length). */ - column->length=test(f_is_blob(sql_field->pack_flag)); + column->length= MY_TEST(f_is_blob(sql_field->pack_flag)); } else { @@ -5290,8 +5290,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, int result __attribute__((unused))= store_create_info(thd, table, &query, create_info, FALSE /* show_database */, - test(create_info->options & - HA_LEX_CREATE_REPLACE)); + MY_TEST(create_info->options & + HA_LEX_CREATE_REPLACE)); DBUG_ASSERT(result == 0); // store_create_info() always return 0 do_logging= FALSE; @@ -7385,7 +7385,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, key= new Key(key_type, key_name, strlen(key_name), &key_create_info, - test(key_info->flags & HA_GENERATED_KEY), + MY_TEST(key_info->flags & HA_GENERATED_KEY), key_parts, key_info->option_list, FALSE); new_key_list.push_back(key); } @@ -8987,7 +8987,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, DBUG_ENTER("copy_data_between_tables"); /* Two or 3 stages; Sorting, copying data and update indexes */ - thd_progress_init(thd, 2 + test(order)); + thd_progress_init(thd, 2 + MY_TEST(order)); if (mysql_trans_prepare_alter_copy_data(thd)) DBUG_RETURN(-1); @@ -9488,7 +9488,7 @@ static bool check_engine(THD *thd, const char *db_name, handlerton **new_engine= &create_info->db_type; handlerton *req_engine= *new_engine; bool no_substitution= - test(thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION); + MY_TEST(thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION); if (!(*new_engine= ha_checktype(thd, ha_legacy_type(req_engine), no_substitution, 1))) DBUG_RETURN(true); diff --git a/sql/sql_time.cc b/sql/sql_time.cc index 5ef7b2c7c34..c906f9e76d7 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -106,9 +106,9 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year) uint days; ulong daynr=calc_daynr(l_time->year,l_time->month,l_time->day); ulong first_daynr=calc_daynr(l_time->year,1,1); - bool monday_first= test(week_behaviour & WEEK_MONDAY_FIRST); - bool week_year= test(week_behaviour & WEEK_YEAR); - bool first_weekday= test(week_behaviour & WEEK_FIRST_WEEKDAY); + bool monday_first= MY_TEST(week_behaviour & WEEK_MONDAY_FIRST); + bool week_year= MY_TEST(week_behaviour & WEEK_YEAR); + bool first_weekday= MY_TEST(week_behaviour & WEEK_FIRST_WEEKDAY); uint weekday=calc_weekday(first_daynr, !monday_first); *year=l_time->year; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index ff2da863db8..e49a8abc95a 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -243,7 +243,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, bool is_union_select; DBUG_ENTER("st_select_lex_unit::prepare"); - describe= test(additional_options & SELECT_DESCRIBE); + describe= MY_TEST(additional_options & SELECT_DESCRIBE); /* result object should be reassigned even if preparing already done for @@ -450,7 +450,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, if (global_parameters->ftfunc_list->elements) create_options= create_options | TMP_TABLE_FORCE_MYISAM; - if (union_result->create_result_table(thd, &types, test(union_distinct), + if (union_result->create_result_table(thd, &types, MY_TEST(union_distinct), create_options, "", FALSE, TRUE)) goto err; if (fake_select_lex && !fake_select_lex->first_cond_optimization) @@ -988,7 +988,7 @@ bool st_select_lex_unit::change_result(select_result_interceptor *new_result, List<Item> *st_select_lex_unit::get_unit_column_types() { SELECT_LEX *sl= first_select(); - bool is_procedure= test(sl->join->procedure); + bool is_procedure= MY_TEST(sl->join->procedure); if (is_procedure) { diff --git a/sql/sql_update.cc b/sql/sql_update.cc index ccdc91e10df..32190a3a8d4 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -255,7 +255,7 @@ int mysql_update(THD *thd, ha_rows *found_return, ha_rows *updated_return) { bool using_limit= limit != HA_POS_ERROR; - bool safe_update= test(thd->variables.option_bits & OPTION_SAFE_UPDATES); + bool safe_update= MY_TEST(thd->variables.option_bits & OPTION_SAFE_UPDATES); bool used_key_is_modified= FALSE, transactional_table, will_batch; bool can_compare_record; int res; @@ -314,7 +314,7 @@ int mysql_update(THD *thd, my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE"); DBUG_RETURN(1); } - query_plan.updating_a_view= test(table_list->view); + query_plan.updating_a_view= MY_TEST(table_list->view); /* Calculate "table->covering_keys" based on the WHERE */ table->covering_keys= table->s->keys_in_use; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b206874c68d..bcc94e80bcf 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -344,7 +344,7 @@ int case_stmt_action_when(LEX *lex, Item *when, bool simple) (jump_if_not from instruction 2 to 5, 5 to 8 ... in the example) */ - return !test(i) || + return !MY_TEST(i) || sp->push_backpatch(i, ctx->push_label(current_thd, empty_lex_str, 0)) || sp->add_cont_backpatch(i) || sp->add_instr(i); @@ -362,7 +362,7 @@ int case_stmt_action_then(LEX *lex) sp_pcontext *ctx= lex->spcont; uint ip= sp->instructions(); sp_instr_jump *i = new sp_instr_jump(ip, ctx); - if (!test(i) || sp->add_instr(i)) + if (!MY_TEST(i) || sp->add_instr(i)) return 1; /* diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 37f2b2519c7..a871d398c68 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2102,7 +2102,7 @@ static bool fix_optimizer_switch(sys_var *self, THD *thd, { SV *sv= (type == OPT_GLOBAL) ? &global_system_variables : &thd->variables; sv->engine_condition_pushdown= - test(sv->optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN); + MY_TEST(sv->optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN); return false; } static Sys_var_flagset Sys_optimizer_switch( @@ -4578,7 +4578,7 @@ static Sys_var_mybool Sys_query_cache_strip_comments( static ulonglong in_transaction(THD *thd) { - return test(thd->in_active_multi_stmt_transaction()); + return MY_TEST(thd->in_active_multi_stmt_transaction()); } static Sys_var_session_special Sys_in_transaction( "in_transaction", "Whether there is an active transaction", diff --git a/sql/table.cc b/sql/table.cc index 78d7e7935fc..f3f18586fef 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -819,8 +819,8 @@ static bool create_key_infos(const uchar *strpos, const uchar *frm_image_end, keyinfo->comment.length); strpos+= keyinfo->comment.length; } - DBUG_ASSERT(test(keyinfo->flags & HA_USES_COMMENT) == - (keyinfo->comment.length > 0)); + DBUG_ASSERT(MY_TEST(keyinfo->flags & HA_USES_COMMENT) == + (keyinfo->comment.length > 0)); } share->keys= keys; // do it *after* all key_info's are initialized @@ -2889,9 +2889,9 @@ partititon_err: else if (outparam->file) { handler::Table_flags flags= outparam->file->ha_table_flags(); - outparam->no_replicate= ! test(flags & (HA_BINLOG_STMT_CAPABLE - | HA_BINLOG_ROW_CAPABLE)) - || test(flags & HA_HAS_OWN_BINLOGGING); + outparam->no_replicate= ! MY_TEST(flags & (HA_BINLOG_STMT_CAPABLE + | HA_BINLOG_ROW_CAPABLE)) + || MY_TEST(flags & HA_HAS_OWN_BINLOGGING); } else { @@ -3253,7 +3253,7 @@ void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo, /* header */ fileinfo[0]=(uchar) 254; fileinfo[1]= 1; - fileinfo[2]= FRM_VER+3+ test(create_info->varchar); + fileinfo[2]= FRM_VER + 3 + MY_TEST(create_info->varchar); fileinfo[3]= (uchar) ha_legacy_type( ha_checktype(thd,ha_legacy_type(create_info->db_type),0,0)); @@ -3272,8 +3272,8 @@ void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo, */ for (i= 0; i < keys; i++) { - DBUG_ASSERT(test(key_info[i].flags & HA_USES_COMMENT) == - (key_info[i].comment.length > 0)); + DBUG_ASSERT(MY_TEST(key_info[i].flags & HA_USES_COMMENT) == + (key_info[i].comment.length > 0)); if (key_info[i].flags & HA_USES_COMMENT) key_comment_total_bytes += 2 + key_info[i].comment.length; } @@ -6183,9 +6183,9 @@ bool TABLE::is_filled_at_execution() do not have a corresponding table reference. Such tables are filled during execution. */ - return test(!pos_in_table_list || - pos_in_table_list->jtbm_subselect || - pos_in_table_list->is_active_sjm()); + return MY_TEST(!pos_in_table_list || + pos_in_table_list->jtbm_subselect || + pos_in_table_list->is_active_sjm()); } diff --git a/sql/table.h b/sql/table.h index b175dfe07a0..71aaf97f596 100644 --- a/sql/table.h +++ b/sql/table.h @@ -2194,7 +2194,7 @@ struct TABLE_LIST */ char *get_table_name() const { return view != NULL ? view_name.str : table_name; } bool is_active_sjm(); - bool is_jtbm() { return test(jtbm_subselect!=NULL); } + bool is_jtbm() { return MY_TEST(jtbm_subselect != NULL); } st_select_lex_unit *get_unit(); st_select_lex *get_single_select(); void wrap_into_nested_join(List<TABLE_LIST> &join_list); diff --git a/sql/transaction.cc b/sql/transaction.cc index 213b6c1a4d8..3575ff52e66 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -138,7 +138,7 @@ bool trans_begin(THD *thd, uint flags) thd->server_status&= ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); - res= test(ha_commit_trans(thd, TRUE)); + res= MY_TEST(ha_commit_trans(thd, TRUE)); } thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG); @@ -172,7 +172,7 @@ bool trans_begin(THD *thd, uint flags) compatibility. */ const bool user_is_super= - test(thd->security_ctx->master_access & SUPER_ACL); + MY_TEST(thd->security_ctx->master_access & SUPER_ACL); if (opt_readonly && !user_is_super) { my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only"); @@ -191,7 +191,7 @@ bool trans_begin(THD *thd, uint flags) if (flags & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT) res= ha_start_consistent_snapshot(thd); - DBUG_RETURN(test(res)); + DBUG_RETURN(MY_TEST(res)); } @@ -228,7 +228,7 @@ bool trans_commit(THD *thd) thd->transaction.all.modified_non_trans_table= FALSE; thd->lex->start_transaction_opt= 0; - DBUG_RETURN(test(res)); + DBUG_RETURN(MY_TEST(res)); } @@ -264,7 +264,7 @@ bool trans_commit_implicit(THD *thd) thd->server_status&= ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); - res= test(ha_commit_trans(thd, TRUE)); + res= MY_TEST(ha_commit_trans(thd, TRUE)); } thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG); @@ -311,7 +311,7 @@ bool trans_rollback(THD *thd) thd->transaction.all.modified_non_trans_table= FALSE; thd->lex->start_transaction_opt= 0; - DBUG_RETURN(test(res)); + DBUG_RETURN(MY_TEST(res)); } @@ -357,7 +357,7 @@ bool trans_rollback_implicit(THD *thd) /* Rollback should clear transaction_rollback_request flag. */ DBUG_ASSERT(! thd->transaction_rollback_request); - DBUG_RETURN(test(res)); + DBUG_RETURN(MY_TEST(res)); } @@ -409,7 +409,7 @@ bool trans_commit_stmt(THD *thd) thd->transaction.stmt.reset(); - DBUG_RETURN(test(res)); + DBUG_RETURN(MY_TEST(res)); } @@ -595,7 +595,7 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_STRING name) if (!res && !binlog_on) thd->mdl_context.rollback_to_savepoint(sv->mdl_savepoint); - DBUG_RETURN(test(res)); + DBUG_RETURN(MY_TEST(res)); } @@ -630,7 +630,7 @@ bool trans_release_savepoint(THD *thd, LEX_STRING name) thd->transaction.savepoints= sv->prev; - DBUG_RETURN(test(res)); + DBUG_RETURN(MY_TEST(res)); } @@ -794,7 +794,7 @@ bool trans_xa_commit(THD *thd) else if (xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE) { int r= ha_commit_trans(thd, TRUE); - if ((res= test(r))) + if ((res= MY_TEST(r))) my_error(r == 1 ? ER_XA_RBROLLBACK : ER_XAER_RMERR, MYF(0)); } else if (xa_state == XA_PREPARED && thd->lex->xa_opt == XA_NONE) @@ -821,7 +821,7 @@ bool trans_xa_commit(THD *thd) { DEBUG_SYNC(thd, "trans_xa_commit_after_acquire_commit_lock"); - res= test(ha_commit_one_phase(thd, 1)); + res= MY_TEST(ha_commit_one_phase(thd, 1)); if (res) my_error(ER_XAER_RMERR, MYF(0)); } diff --git a/sql/tztime.cc b/sql/tztime.cc index 94fcfc7bfcf..b0c5a0830fc 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2822,7 +2822,7 @@ main(int argc, char **argv) if (TYPE_SIGNED(time_t)) { t= -100; - localtime_negative= test(localtime_r(&t, &tmp) != 0); + localtime_negative= MY_TEST(localtime_r(&t, &tmp) != 0); printf("localtime_r %s negative params \ (time_t=%d is %d-%d-%d %d:%d:%d)\n", (localtime_negative ? "supports" : "doesn't support"), (int)t, diff --git a/sql/uniques.cc b/sql/uniques.cc index 0c1c34d495b..0990182dbdb 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -86,7 +86,7 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg, full_size= size; if (min_dupl_count_arg) full_size+= sizeof(element_count); - with_counters= test(min_dupl_count_arg); + with_counters= MY_TEST(min_dupl_count_arg); my_b_clear(&file); init_tree(&tree, (ulong) (max_in_memory_size / 16), 0, size, comp_func, NULL, comp_func_fixed_arg, MYF(MY_THREAD_SPECIFIC)); diff --git a/sql/unireg.cc b/sql/unireg.cc index 7bb943dc9b0..ad2d711be99 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -280,8 +280,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, int2store(forminfo+2, frm.length - filepos); int4store(fileinfo+10, frm.length); - fileinfo[26]= (uchar) test((create_info->max_rows == 1) && - (create_info->min_rows == 1) && (keys == 0)); + fileinfo[26]= (uchar) MY_TEST((create_info->max_rows == 1) && + (create_info->min_rows == 1) && (keys == 0)); int2store(fileinfo+28,key_info_length); if (part_info) @@ -898,7 +898,7 @@ static bool pack_fields(uchar *buff, List<Create_field> &create_fields, */ if (field->vcol_info && field->vcol_info->expr_str.length) { - *buff++= (uchar)(1 + test(field->interval)); + *buff++= (uchar) (1 + MY_TEST(field->interval)); *buff++= (uchar) field->sql_type; *buff++= (uchar) field->stored_in_db; if (field->interval) diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 644f6c2a04e..43e9e7b598c 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1466,7 +1466,7 @@ prepare_for_next_key_part: ptr was incremented by 1. Since store_length still counts null-byte, we need to subtract 1 from store_length. */ - ptr+= store_length - test(key_part->null_bit); + ptr+= store_length - MY_TEST(key_part->null_bit); if (tmp.append(STRING_WITH_LEN(" AND "))) goto err; @@ -2129,7 +2129,7 @@ int ha_federated::update_row(const uchar *old_data, uchar *new_data) this? Because we only are updating one record, and LIMIT enforces this. */ - bool has_a_primary_key= test(table->s->primary_key != MAX_KEY); + bool has_a_primary_key= MY_TEST(table->s->primary_key != MAX_KEY); /* buffers for following strings diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index f8ec026be66..a4bea0b2cad 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -1386,7 +1386,7 @@ prepare_for_next_key_part: ptr was incremented by 1. Since store_length still counts null-byte, we need to subtract 1 from store_length. */ - ptr+= store_length - test(key_part->null_bit); + ptr+= store_length - MY_TEST(key_part->null_bit); if (tmp.append(STRING_WITH_LEN(" AND "))) goto err; @@ -2286,7 +2286,7 @@ int ha_federatedx::update_row(const uchar *old_data, uchar *new_data) this? Because we only are updating one record, and LIMIT enforces this. */ - bool has_a_primary_key= test(table->s->primary_key != MAX_KEY); + bool has_a_primary_key= MY_TEST(table->s->primary_key != MAX_KEY); /* buffers for following strings diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index b9ff9d28159..73dce174a09 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -90,7 +90,7 @@ ha_heap::ha_heap(handlerton *hton, TABLE_SHARE *table_arg) int ha_heap::open(const char *name, int mode, uint test_if_locked) { - internal_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE); + internal_table= MY_TEST(test_if_locked & HA_OPEN_INTERNAL_TABLE); if (internal_table || (!(file= heap_open(name, mode)) && my_errno == ENOENT)) { HP_CREATE_INFO create_info; @@ -106,7 +106,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked) if (rc) goto end; - implicit_emptied= test(created_new_share); + implicit_emptied= MY_TEST(created_new_share); if (internal_table) file= heap_open_from_share(internal_share, mode); else diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c index 2abed55459c..f96cf866138 100644 --- a/storage/heap/hp_hash.c +++ b/storage/heap/hp_hash.c @@ -640,7 +640,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key) { if (seg->null_bit) { - int found_null=test(rec[seg->null_pos] & seg->null_bit); + int found_null= MY_TEST(rec[seg->null_pos] & seg->null_bit); if (found_null != (int) *key++) return 1; if (found_null) @@ -737,7 +737,7 @@ void hp_make_key(HP_KEYDEF *keydef, uchar *key, const uchar *rec) uint char_length= seg->length; uchar *pos= (uchar*) rec + seg->start; if (seg->null_bit) - *key++= test(rec[seg->null_pos] & seg->null_bit); + *key++= MY_TEST(rec[seg->null_pos] & seg->null_bit); if (cs->mbmaxlen > 1) { char_length= my_charpos(cs, pos, pos + seg->length, @@ -776,7 +776,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, uchar *key, uint char_length; if (seg->null_bit) { - if (!(*key++= 1 - test(rec[seg->null_pos] & seg->null_bit))) + if (!(*key++= 1 - MY_TEST(rec[seg->null_pos] & seg->null_bit))) continue; } if (seg->flag & HA_SWAP_KEY) diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 5c410151456..081e90f89f7 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -724,8 +724,8 @@ int maria_check_definition(MARIA_KEYDEF *t1_keyinfo, { DBUG_PRINT("error", ("Key %d has different definition", i)); DBUG_PRINT("error", ("t1_fulltext= %d, t2_fulltext=%d", - test(t1_keyinfo[i].flag & HA_FULLTEXT), - test(t2_keyinfo[i].flag & HA_FULLTEXT))); + MY_TEST(t1_keyinfo[i].flag & HA_FULLTEXT), + MY_TEST(t2_keyinfo[i].flag & HA_FULLTEXT))); DBUG_RETURN(1); } if (t1_keyinfo[i].flag & HA_SPATIAL && t2_keyinfo[i].flag & HA_SPATIAL) @@ -735,8 +735,8 @@ int maria_check_definition(MARIA_KEYDEF *t1_keyinfo, { DBUG_PRINT("error", ("Key %d has different definition", i)); DBUG_PRINT("error", ("t1_spatial= %d, t2_spatial=%d", - test(t1_keyinfo[i].flag & HA_SPATIAL), - test(t2_keyinfo[i].flag & HA_SPATIAL))); + MY_TEST(t1_keyinfo[i].flag & HA_SPATIAL), + MY_TEST(t2_keyinfo[i].flag & HA_SPATIAL))); DBUG_RETURN(1); } if (t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs || @@ -1334,7 +1334,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) share->pack.header_length, 1, MYF(MY_WME)))) { error= maria_chk_data_link(¶m, file, - test(param.testflag & T_EXTEND)); + MY_TEST(param.testflag & T_EXTEND)); end_io_cache(&(param.read_cache)); } param.testflag= old_testflag; @@ -1627,7 +1627,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) thd_proc_info(thd, buf); param->testflag|= T_REP_PARALLEL; error= maria_repair_parallel(param, file, fixed_name, - test(param->testflag & T_QUICK)); + MY_TEST(param->testflag & T_QUICK)); /* to reset proc_info, as it was pointing to local buffer */ thd_proc_info(thd, "Repair done"); } @@ -1636,7 +1636,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) thd_proc_info(thd, "Repair by sorting"); param->testflag|= T_REP_BY_SORT; error= maria_repair_by_sort(param, file, fixed_name, - test(param->testflag & T_QUICK)); + MY_TEST(param->testflag & T_QUICK)); } if (error && file->create_unique_index_by_sort && share->state.dupp_key != MAX_KEY) @@ -1648,7 +1648,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) thd_proc_info(thd, "Repair with keycache"); param->testflag &= ~(T_REP_BY_SORT | T_REP_PARALLEL); error= maria_repair(param, file, fixed_name, - test(param->testflag & T_QUICK)); + MY_TEST(param->testflag & T_QUICK)); } param->testflag= save_testflag | (param->testflag & T_RETRY_WITHOUT_QUICK); optimize_done= 1; @@ -1656,7 +1656,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) set full_repair_done if we re-wrote all rows and all keys (and thus removed all transid's from the table */ - full_repair_done= !test(param->testflag & T_QUICK); + full_repair_done= !MY_TEST(param->testflag & T_QUICK); } if (!error) { @@ -2124,7 +2124,7 @@ void ha_maria::start_bulk_insert(ha_rows rows, uint flags) } else { - my_bool all_keys= test(flags & HA_CREATE_UNIQUE_INDEX_BY_SORT); + my_bool all_keys= MY_TEST(flags & HA_CREATE_UNIQUE_INDEX_BY_SORT); maria_disable_indexes_for_rebuild(file, rows, all_keys); } if (share->now_transactional) @@ -3300,7 +3300,7 @@ static int maria_rollback(handlerton *hton __attribute__ ((unused)), bool maria_flush_logs(handlerton *hton) { - return test(translog_purge_at_flush()); + return MY_TEST(translog_purge_at_flush()); } diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index 7d12f1637b4..2b99c31ec5d 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -146,7 +146,7 @@ public: bool auto_repair(int error) const { /* Always auto-repair moved tables (error == HA_ERR_OLD_FILE) */ - return ((test(maria_recover_options & HA_RECOVER_ANY) && + return ((MY_TEST(maria_recover_options & HA_RECOVER_ANY) && error == HA_ERR_CRASHED_ON_USAGE) || error == HA_ERR_OLD_FILE); diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index 7f8fd699e5d..c6371287063 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -2367,7 +2367,7 @@ static my_bool extent_to_bitmap_blocks(MARIA_HA *info, DBUG_PRINT("error", ("page: %lu page_count: %u tail: %u length: %ld data_length: %ld", (ulong) block->page, (block->page_count & ~TAIL_BIT), - (uint) test(block->page_count & TAIL_BIT), + (uint) MY_TEST(block->page_count & TAIL_BIT), (ulong) ((block->page + (page_count & ~TAIL_BIT)) * share->block_size), (ulong) share->state.state.data_file_length)); diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index e21690a6b53..4ac267ffb8a 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -1454,7 +1454,7 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend, if (param->testflag & (T_EXTEND | T_MEDIUM | T_VERBOSE)) { if (_ma_rec_check(info,record, info->rec_buff,block_info.rec_len, - test(share->calc_checksum), checksum)) + MY_TEST(share->calc_checksum), checksum)) { _ma_check_print_error(param,"Found wrong packed record at %s", llstr(start_recpos,llbuff)); @@ -2385,7 +2385,7 @@ static int initialize_variables_for_repair(HA_CHECK *param, sort_param->sort_info= sort_info; sort_param->fix_datafile= ! rep_quick; - sort_param->calc_checksum= test(param->testflag & T_CALC_CHECKSUM); + sort_param->calc_checksum= MY_TEST(param->testflag & T_CALC_CHECKSUM); sort_info->info= sort_info->new_info= info; sort_info->param= param; set_data_file_type(sort_info, info->s); @@ -2395,8 +2395,9 @@ static int initialize_variables_for_repair(HA_CHECK *param, info->rec_cache.file= info->dfile.file; info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); - if (protect_against_repair_crash(info, param, !test(param->testflag & - T_CREATE_MISSING_KEYS))) + if (protect_against_repair_crash(info, param, + !MY_TEST(param->testflag & + T_CREATE_MISSING_KEYS))) return 1; /* calculate max_records */ @@ -3836,7 +3837,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, if (keyseg[i].flag & HA_SPACE_PACK) sort_param.key_length+=get_pack_length(keyseg[i].length); if (keyseg[i].flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART)) - sort_param.key_length+=2 + test(keyseg[i].length >= 127); + sort_param.key_length+= 2 + MY_TEST(keyseg[i].length >= 127); if (keyseg[i].flag & HA_NULL_PART) sort_param.key_length++; } @@ -4405,7 +4406,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info, if (keyseg->flag & HA_SPACE_PACK) sort_param[i].key_length+=get_pack_length(keyseg->length); if (keyseg->flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART)) - sort_param[i].key_length+=2 + test(keyseg->length >= 127); + sort_param[i].key_length+= 2 + MY_TEST(keyseg->length >= 127); if (keyseg->flag & HA_NULL_PART) sort_param[i].key_length++; } @@ -4424,7 +4425,7 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info, sort_info.total_keys=i; sort_param[0].master= 1; sort_param[0].fix_datafile= ! rep_quick; - sort_param[0].calc_checksum= test(param->testflag & T_CALC_CHECKSUM); + sort_param[0].calc_checksum= MY_TEST(param->testflag & T_CALC_CHECKSUM); if (!maria_ftparser_alloc_param(info)) goto err; @@ -5225,7 +5226,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) sort_param->find_length, (param->testflag & T_QUICK) && sort_param->calc_checksum && - test(share->calc_checksum), checksum)) + MY_TEST(share->calc_checksum), checksum)) { _ma_check_print_info(param,"Found wrong packed record at %s", llstr(sort_param->start_recpos,llbuff)); @@ -5413,7 +5414,7 @@ int _ma_sort_write_record(MARIA_SORT_PARAM *sort_param) do { - block_length=reclength+ 3 + test(reclength >= (65520-3)); + block_length= reclength + 3 + MY_TEST(reclength >= (65520 - 3)); if (block_length < share->base.min_block_length) block_length=share->base.min_block_length; info->update|=HA_STATE_WRITE_AT_END; @@ -6412,7 +6413,7 @@ static ha_checksum maria_byte_checksum(const uchar *buf, uint length) const uchar *end=buf+length; for (crc=0; buf != end; buf++) crc=((crc << 1) + *buf) + - test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1))); + MY_TEST(crc & (((ha_checksum) 1) << (8 * sizeof(ha_checksum) - 1))); return crc; } diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index 023dbd5bb49..1176b2037b5 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -209,7 +209,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, options|= HA_OPTION_NULL_FIELDS; /* Use ma_checksum() */ /* We must test for 257 as length includes pack-length */ - if (test(column->length >= 257)) + if (MY_TEST(column->length >= 257)) { long_varchar_count++; max_field_lengths++; @@ -308,7 +308,8 @@ int maria_create(const char *name, enum data_file_type datafile_type, pack_bytes= (packed + 7) / 8; if (pack_reclength != INT_MAX32) pack_reclength+= reclength+pack_bytes + - test(test_all_bits(options, HA_OPTION_CHECKSUM | HA_OPTION_PACK_RECORD)); + MY_TEST(test_all_bits(options, HA_OPTION_CHECKSUM | + HA_OPTION_PACK_RECORD)); min_pack_length+= pack_bytes; /* Calculate min possible row length for rows-in-block */ extra_header_size= MAX_FIXED_HEADER_SIZE; @@ -730,7 +731,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, share.base.records=ci->max_rows; share.base.reloc= ci->reloc_rows; share.base.reclength=real_reclength; - share.base.pack_reclength=reclength+ test(options & HA_OPTION_CHECKSUM); + share.base.pack_reclength= reclength + MY_TEST(options & HA_OPTION_CHECKSUM); share.base.max_pack_length=pack_reclength; share.base.min_pack_length=min_pack_length; share.base.pack_bytes= pack_bytes; @@ -1033,7 +1034,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, remember if the data file was created or not, to know if Recovery can do it or not, in the future */ - log_data[0]= test(flags & HA_DONT_TOUCH_DATA); + log_data[0]= MY_TEST(flags & HA_DONT_TOUCH_DATA); int2store(log_data + 1, kfile_size_before_extension); int2store(log_data + 1 + 2, share.base.keystart); log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (uchar *)name; diff --git a/storage/maria/ma_dynrec.c b/storage/maria/ma_dynrec.c index 4bb51d0dcf3..b0280f5278b 100644 --- a/storage/maria/ma_dynrec.c +++ b/storage/maria/ma_dynrec.c @@ -406,7 +406,7 @@ static int _ma_find_writepos(MARIA_HA *info, { /* No deleted blocks; Allocate a new block */ *filepos=info->state->data_file_length; - if ((tmp=reclength+3 + test(reclength >= (65520-3))) < + if ((tmp= reclength + 3 + MY_TEST(reclength >= (65520 - 3))) < info->s->base.min_block_length) tmp= info->s->base.min_block_length; else @@ -849,7 +849,7 @@ static my_bool update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS filepos, if (length < reclength) { uint tmp=MY_ALIGN(reclength - length + 3 + - test(reclength >= 65520L),MARIA_DYN_ALIGN_SIZE); + MY_TEST(reclength >= 65520L), MARIA_DYN_ALIGN_SIZE); /* Don't create a block bigger than MARIA_MAX_BLOCK_LENGTH */ tmp= MY_MIN(length+tmp, MARIA_MAX_BLOCK_LENGTH)-length; /* Check if we can extend this block */ @@ -1014,7 +1014,7 @@ uint _ma_rec_pack(MARIA_HA *info, register uchar *to, pos++; } new_length=(uint) (end-pos); - if (new_length +1 + test(column->length > 255 && new_length > 127) + if (new_length + 1 + MY_TEST(column->length > 255 && new_length > 127) < length) { if (column->length > 255 && new_length > 127) @@ -1138,7 +1138,7 @@ my_bool _ma_rec_check(MARIA_HA *info,const uchar *record, uchar *rec_buff, pos++; } new_length=(uint) (end-pos); - if (new_length +1 + test(column->length > 255 && new_length > 127) + if (new_length + 1 + MY_TEST(column->length > 255 && new_length > 127) < length) { if (!(flag & bit)) @@ -1191,7 +1191,7 @@ my_bool _ma_rec_check(MARIA_HA *info,const uchar *record, uchar *rec_buff, to+= length; } if (packed_length != (uint) (to - rec_buff) + - test(info->s->calc_checksum) || (bit != 1 && (flag & ~(bit - 1)))) + MY_TEST(info->s->calc_checksum) || (bit != 1 && (flag & ~(bit - 1)))) goto err; if (with_checksum && ((uchar) checksum != (uchar) *to)) { diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c index 66e7b4033c7..fd21d2863f8 100644 --- a/storage/maria/ma_extra.c +++ b/storage/maria/ma_extra.c @@ -58,7 +58,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, { reinit_io_cache(&info->rec_cache,READ_CACHE,0, (pbool) (info->lock_type != F_UNLCK), - (pbool) test(info->update & HA_STATE_ROW_CHANGED) + (pbool) MY_TEST(info->update & HA_STATE_ROW_CHANGED) ); } info->update= ((info->update & HA_STATE_CHANGED) | HA_STATE_NEXT_FOUND | @@ -122,7 +122,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, { reinit_io_cache(&info->rec_cache, READ_CACHE, info->cur_row.nextpos, (pbool) (info->lock_type != F_UNLCK), - (pbool) test(info->update & HA_STATE_ROW_CHANGED)); + (pbool) MY_TEST(info->update & HA_STATE_ROW_CHANGED)); info->update&= ~HA_STATE_ROW_CHANGED; if (share->non_transactional_concurrent_insert) info->rec_cache.end_of_file= info->state->data_file_length; @@ -316,7 +316,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, /* Fall trough */ case HA_EXTRA_PREPARE_FOR_RENAME: { - my_bool do_flush= test(function != HA_EXTRA_PREPARE_FOR_DROP); + my_bool do_flush= MY_TEST(function != HA_EXTRA_PREPARE_FOR_DROP); my_bool save_global_changed; enum flush_type type; /* diff --git a/storage/maria/ma_ft_boolean_search.c b/storage/maria/ma_ft_boolean_search.c index e69c90c671c..af2ad6f1ba9 100644 --- a/storage/maria/ma_ft_boolean_search.c +++ b/storage/maria/ma_ft_boolean_search.c @@ -523,7 +523,7 @@ static void _ftb_init_index_search(FT_INFO *ftb) { if (ftbe->flags & FTB_FLAG_NO || /* 2 */ ftbe->up->ythresh - ftbe->up->yweaks > - (uint) test(ftbe->flags & FTB_FLAG_YES)) /* 1 */ + (uint) MY_TEST(ftbe->flags & FTB_FLAG_YES)) /* 1 */ { FTB_EXPR *top_ftbe=ftbe->up; ftbw->docid[0]=HA_OFFSET_ERROR; diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c index 0ec0244bcbd..dd679f53533 100644 --- a/storage/maria/ma_locking.c +++ b/storage/maria/ma_locking.c @@ -535,7 +535,7 @@ int _ma_decrement_open_count(MARIA_HA *info, my_bool lock_tables) if (!lock_error && !my_disable_locking && lock_tables) lock_error=maria_lock_database(info,old_lock); } - DBUG_RETURN(test(lock_error || write_error)); + DBUG_RETURN(MY_TEST(lock_error || write_error)); } diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index ae58be55105..39103dfcd97 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -1562,7 +1562,7 @@ static my_bool translog_close_log_file(TRANSLOG_FILE *file) } rc|= mysql_file_close(file->handler.file, MYF(MY_WME)); my_free(file); - return test(rc); + return MY_TEST(rc); } @@ -8232,9 +8232,9 @@ my_bool translog_is_file(uint file_no) { MY_STAT stat_buff; char path[FN_REFLEN]; - return (test(mysql_file_stat(key_file_translog, - translog_filename_by_fileno(file_no, path), - &stat_buff, MYF(0)))); + return (MY_TEST(mysql_file_stat(key_file_translog, + translog_filename_by_fileno(file_no, path), + &stat_buff, MYF(0)))); } @@ -8529,8 +8529,8 @@ my_bool translog_purge(TRANSLOG_ADDRESS low) { char path[FN_REFLEN], *file_name; file_name= translog_filename_by_fileno(i, path); - rc= test(mysql_file_delete(key_file_translog, - file_name, MYF(MY_WME))); + rc= MY_TEST(mysql_file_delete(key_file_translog, + file_name, MYF(MY_WME))); } } if (unlikely(rc == 1)) @@ -8592,8 +8592,8 @@ my_bool translog_purge_at_flush() char path[FN_REFLEN], *file_name; DBUG_PRINT("info", ("purge file %lu\n", (ulong) i)); file_name= translog_filename_by_fileno(i, path); - rc= test(mysql_file_delete(key_file_translog, - file_name, MYF(MY_WME))); + rc= MY_TEST(mysql_file_delete(key_file_translog, + file_name, MYF(MY_WME))); } mysql_mutex_unlock(&log_descriptor.purger_lock); diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index a1d4e215118..e06084cef07 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -273,7 +273,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) int kfile,open_mode,save_errno; uint i,j,len,errpos,head_length,base_pos,keys, realpath_err, key_parts,unique_key_parts,fulltext_keys,uniques; - uint internal_table= test(open_flags & HA_OPEN_INTERNAL_TABLE); + uint internal_table= MY_TEST(open_flags & HA_OPEN_INTERNAL_TABLE); size_t info_length; char name_buff[FN_REFLEN], org_name[FN_REFLEN], index_name[FN_REFLEN], data_name[FN_REFLEN]; @@ -731,7 +731,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) share->base.is_nulls_extended + share->base.null_bytes + share->base.pack_bytes + - test(share->options & HA_OPTION_CHECKSUM)); + MY_TEST(share->options & HA_OPTION_CHECKSUM)); share->kfile.file= kfile; if (open_flags & HA_OPEN_COPY) diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c index 9b06c0d4f78..a541a657ed2 100644 --- a/storage/maria/ma_packrec.c +++ b/storage/maria/ma_packrec.c @@ -146,9 +146,9 @@ my_bool _ma_once_init_pack_row(MARIA_SHARE *share, File dfile) share->options|= HA_OPTION_READ_ONLY_DATA; return (_ma_read_pack_info(share, dfile, (pbool) - test(!(share->options & - (HA_OPTION_PACK_RECORD | - HA_OPTION_TEMP_COMPRESS_RECORD))))); + MY_TEST(!(share->options & + (HA_OPTION_PACK_RECORD | + HA_OPTION_TEMP_COMPRESS_RECORD))))); } diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 4a3c3efd3fb..8e8ecf945f0 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -482,7 +482,7 @@ error: DBUG_PRINT("info", ("info_check_lock: thread: 0x%lx block 0x%lx: info: %d wrt: %d," "to lock: %s, to pin: %s", - (ulong)thread, (ulong)block, test(info), + (ulong) thread, (ulong) block, MY_TEST(info), (info ? info->write_lock : 0), page_cache_page_lock_str[lock], page_cache_page_pin_str[pin])); diff --git a/storage/maria/ma_pagecrc.c b/storage/maria/ma_pagecrc.c index a79f34016c1..d3522fa4e88 100644 --- a/storage/maria/ma_pagecrc.c +++ b/storage/maria/ma_pagecrc.c @@ -88,7 +88,7 @@ static my_bool maria_page_crc_check(uchar *page, } new_crc= maria_page_crc((uint32) page_no, page, data_length); DBUG_ASSERT(new_crc != no_crc_val); - res= test(new_crc != crc); + res= MY_TEST(new_crc != crc); if (res) { /* diff --git a/storage/maria/ma_range.c b/storage/maria/ma_range.c index 475665e17c3..7747df6415a 100644 --- a/storage/maria/ma_range.c +++ b/storage/maria/ma_range.c @@ -276,7 +276,7 @@ static double _ma_search_pos(MARIA_HA *info, MARIA_KEY *key, } DBUG_PRINT("info",("keynr: %d offset: %g max_keynr: %d nod: %d flag: %d", keynr,offset,max_keynr,page.node,flag)); - DBUG_RETURN((keynr+offset)/(max_keynr+test(page.node))); + DBUG_RETURN((keynr + offset) / (max_keynr + MY_TEST(page.node))); err: DBUG_PRINT("exit",("Error: %d",my_errno)); DBUG_RETURN (-1.0); diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index 33d97a186dd..59e0630be8c 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -1176,7 +1176,7 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE) DBUG_ASSERT(maria_tmpdir); info->s->state.key_map= uint8korr(rec->header + FILEID_STORE_SIZE + 8); - quick_repair= test(param.testflag & T_QUICK); + quick_repair= MY_TEST(param.testflag & T_QUICK); if (param.testflag & T_REP_PARALLEL) { diff --git a/storage/maria/ma_test1.c b/storage/maria/ma_test1.c index 001717932f9..595b87ef4d0 100644 --- a/storage/maria/ma_test1.c +++ b/storage/maria/ma_test1.c @@ -195,7 +195,7 @@ static int run_test(const char *filename) else uniques=0; - offset_to_key= test(null_fields); + offset_to_key= MY_TEST(null_fields); if (key_field == FIELD_BLOB || key_field == FIELD_VARCHAR) offset_to_key+= 2; diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index a9af6e69154..623d3c6c92e 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -973,7 +973,7 @@ static int maria_chk(HA_CHECK *param, char *filename) { int error,lock_type,recreate; uint warning_printed_by_chk_status; - my_bool rep_quick= test(param->testflag & (T_QUICK | T_FORCE_UNIQUENESS)); + my_bool rep_quick= MY_TEST(param->testflag & (T_QUICK | T_FORCE_UNIQUENESS)); MARIA_HA *info; File datafile; char llbuff[22],llbuff2[22]; @@ -1366,7 +1366,7 @@ static int maria_chk(HA_CHECK *param, char *filename) if ((info->s->data_file_type != STATIC_RECORD) || (param->testflag & (T_EXTEND | T_MEDIUM))) error|=maria_chk_data_link(param, info, - test(param->testflag & T_EXTEND)); + MY_TEST(param->testflag & T_EXTEND)); end_io_cache(¶m->read_cache); } if (!error) @@ -1391,7 +1391,8 @@ static int maria_chk(HA_CHECK *param, char *filename) if ((param->testflag & T_AUTO_INC) || ((param->testflag & T_REP_ANY) && info->s->base.auto_key)) _ma_update_auto_increment_key(param, info, - (my_bool) !test(param->testflag & T_AUTO_INC)); + (my_bool) + !MY_TEST(param->testflag & T_AUTO_INC)); if (info->update & HA_STATE_CHANGED && ! (param->testflag & T_READONLY)) { diff --git a/storage/maria/unittest/ma_pagecache_single.c b/storage/maria/unittest/ma_pagecache_single.c index d7da87a3821..0031582589e 100644 --- a/storage/maria/unittest/ma_pagecache_single.c +++ b/storage/maria/unittest/ma_pagecache_single.c @@ -166,15 +166,15 @@ int simple_read_write_test() PAGECACHE_PLAIN_PAGE, PAGECACHE_LOCK_LEFT_UNLOCKED, 0); - ok((res= test(memcmp(buffr, buffw, TEST_PAGE_SIZE) == 0)), + ok((res= MY_TEST(memcmp(buffr, buffw, TEST_PAGE_SIZE) == 0)), "Simple write-read page "); if (flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE)) { diag("Got error during flushing pagecache\n"); exit(1); } - ok((res&= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, - simple_read_write_test_file))), + ok((res&= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, + simple_read_write_test_file))), "Simple write-read page file"); if (res) reset_file(&file1, file1_name); @@ -225,7 +225,7 @@ int simple_read_change_write_read_test() PAGECACHE_PLAIN_PAGE, PAGECACHE_LOCK_LEFT_UNLOCKED, 0); - ok((res= test(memcmp(buffr, buffw, TEST_PAGE_SIZE) == 0)), + ok((res= MY_TEST(memcmp(buffr, buffw, TEST_PAGE_SIZE) == 0)), "Simple read-change-write-read page "); DBUG_ASSERT(pagecache.blocks_changed == 1); if (flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE)) @@ -234,8 +234,8 @@ int simple_read_change_write_read_test() exit(1); } DBUG_ASSERT(pagecache.blocks_changed == 0); - ok((res2= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, - simple_read_change_write_read_test_file))), + ok((res2= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, + simple_read_change_write_read_test_file))), "Simple read-change-write-read page file"); if (res && res2) reset_file(&file1, file1_name); @@ -299,8 +299,8 @@ int simple_pin_test() res= 0; goto err; } - ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE*2, TEST_PAGE_SIZE*2, - simple_pin_test_file1))), + ok((res= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE * 2, + TEST_PAGE_SIZE * 2, simple_pin_test_file1))), "Simple pin page file with pin"); pagecache_unlock(&pagecache, &file1, @@ -314,8 +314,8 @@ int simple_pin_test() res= 0; goto err; } - ok((res&= test(test_file(file1, file1_name, TEST_PAGE_SIZE*2, TEST_PAGE_SIZE, - simple_pin_test_file2))), + ok((res&= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE * 2, + TEST_PAGE_SIZE, simple_pin_test_file2))), "Simple pin page result file"); if (res) reset_file(&file1, file1_name); @@ -378,8 +378,8 @@ int simple_pin_test2() res= 0; goto err; } - ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE*2, TEST_PAGE_SIZE*2, - simple_pin_test_file1))), + ok((res= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE * 2, + TEST_PAGE_SIZE * 2, simple_pin_test_file1))), "Simple pin page file with pin 2"); /* Test that a normal flush goes through */ @@ -401,8 +401,8 @@ int simple_pin_test2() res= 0; goto err; } - ok((res&= test(test_file(file1, file1_name, TEST_PAGE_SIZE*2, TEST_PAGE_SIZE, - simple_pin_test_file2))), + ok((res&= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE * 2, + TEST_PAGE_SIZE, simple_pin_test_file2))), "Simple pin page result file 2"); if (res) reset_file(&file1, file1_name); @@ -451,8 +451,8 @@ int simple_pin_no_lock_test() res= 0; goto err; } - ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, - simple_pin_no_lock_test_file1))), + ok((res= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, + simple_pin_no_lock_test_file1))), "Simple pin (no lock) page file with pin 2"); pagecache_unlock(&pagecache, &file1, @@ -466,8 +466,8 @@ int simple_pin_no_lock_test() res= 0; goto err; } - ok((res&= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, - simple_pin_no_lock_test_file2))), + ok((res&= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, + simple_pin_no_lock_test_file2))), "Simple pin (no lock) page result file 2"); bfill(buffw, TEST_PAGE_SIZE, '\6'); @@ -486,8 +486,8 @@ int simple_pin_no_lock_test() res= 0; goto err; } - ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, - simple_pin_no_lock_test_file2))), + ok((res= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, + simple_pin_no_lock_test_file2))), "Simple pin (no lock) page file with pin 3"); pagecache_unpin_by_link(&pagecache, link, 0); if (flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE)) @@ -496,8 +496,8 @@ int simple_pin_no_lock_test() res= 0; goto err; } - ok((res&= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, - simple_pin_no_lock_test_file3))), + ok((res&= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, + simple_pin_no_lock_test_file3))), "Simple pin (no lock) page result file 3"); if (res) reset_file(&file1, file1_name); @@ -536,8 +536,8 @@ int simple_delete_forget_test() pagecache_delete(&pagecache, &file1, 0, PAGECACHE_LOCK_WRITE, 0); flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE); - ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, - simple_delete_forget_test_file))), + ok((res= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, + simple_delete_forget_test_file))), "Simple delete-forget page file"); if (res) reset_file(&file1, file1_name); @@ -583,8 +583,8 @@ int simple_delete_flush_test() exit(1); } flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE); - ok((res= test(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, - simple_delete_flush_test_file))), + ok((res= MY_TEST(test_file(file1, file1_name, TEST_PAGE_SIZE, TEST_PAGE_SIZE, + simple_delete_flush_test_file))), "Simple delete flush (link) page file"); if (res) reset_file(&file1, file1_name); @@ -665,8 +665,8 @@ int simple_big_test() ok(1, "Simple big file random read"); flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE); - ok((res= test(test_file(file1, file1_name, PCACHE_SIZE*2, TEST_PAGE_SIZE, - desc))), + ok((res= MY_TEST(test_file(file1, file1_name, PCACHE_SIZE * 2, TEST_PAGE_SIZE, + desc))), "Simple big file"); if (res) reset_file(&file1, file1_name); diff --git a/storage/maria/unittest/ma_test_loghandler-t.c b/storage/maria/unittest/ma_test_loghandler-t.c index ccaa6f7dc8e..abf2078ce8f 100644 --- a/storage/maria/unittest/ma_test_loghandler-t.c +++ b/storage/maria/unittest/ma_test_loghandler-t.c @@ -661,7 +661,7 @@ err: if (maria_log_remove(maria_data_root)) exit(1); - return(test(exit_status())); + return(MY_TEST(exit_status())); } #include "../ma_check_standalone.h" diff --git a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c index 56329a18d7d..c8e63cb26ab 100644 --- a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c +++ b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c @@ -758,7 +758,7 @@ err: if (maria_log_remove(maria_data_root)) exit(1); - return (test(exit_status())); + return (MY_TEST(exit_status())); } #include "../ma_check_standalone.h" diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 70a7037a446..6befe3b2d7a 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -533,7 +533,7 @@ static void _ftb_init_index_search(FT_INFO *ftb) { if (ftbe->flags & FTB_FLAG_NO || /* 2 */ ftbe->up->ythresh - ftbe->up->yweaks > - (uint) test(ftbe->flags & FTB_FLAG_YES)) /* 1 */ + (uint) MY_TEST(ftbe->flags & FTB_FLAG_YES)) /* 1 */ { FTB_EXPR *top_ftbe=ftbe->up; ftbw->docid[0]=HA_OFFSET_ERROR; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 0178e2abfa9..18f0c3b7f60 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -480,8 +480,8 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo, { DBUG_PRINT("error", ("Key %d has different definition", i)); DBUG_PRINT("error", ("t1_fulltext= %d, t2_fulltext=%d", - test(t1_keyinfo[i].flag & HA_FULLTEXT), - test(t2_keyinfo[i].flag & HA_FULLTEXT))); + MY_TEST(t1_keyinfo[i].flag & HA_FULLTEXT), + MY_TEST(t2_keyinfo[i].flag & HA_FULLTEXT))); DBUG_RETURN(1); } if (t1_keyinfo[i].flag & HA_SPATIAL && t2_keyinfo[i].flag & HA_SPATIAL) @@ -491,8 +491,8 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo, { DBUG_PRINT("error", ("Key %d has different definition", i)); DBUG_PRINT("error", ("t1_spatial= %d, t2_spatial=%d", - test(t1_keyinfo[i].flag & HA_SPATIAL), - test(t2_keyinfo[i].flag & HA_SPATIAL))); + MY_TEST(t1_keyinfo[i].flag & HA_SPATIAL), + MY_TEST(t2_keyinfo[i].flag & HA_SPATIAL))); DBUG_RETURN(1); } if ((!mysql_40_compat && @@ -913,7 +913,7 @@ int ha_myisam::check(THD* thd, HA_CHECK_OPT* check_opt) my_default_record_cache_size, READ_CACHE, share->pack.header_length, 1, MYF(MY_WME)))) { - error= chk_data_link(¶m, file, test(param.testflag & T_EXTEND)); + error= chk_data_link(¶m, file, MY_TEST(param.testflag & T_EXTEND)); end_io_cache(&(param.read_cache)); } param.testflag= old_testflag; @@ -1109,7 +1109,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) share->state.key_map); ulonglong testflag= param.testflag; #ifdef HAVE_MMAP - bool remap= test(share->file_map); + bool remap= MY_TEST(share->file_map); /* mi_repair*() functions family use file I/O even if memory mapping is available. @@ -1131,14 +1131,14 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) /* TODO: respect myisam_repair_threads variable */ thd_proc_info(thd, "Parallel repair"); error = mi_repair_parallel(¶m, file, fixed_name, - test(param.testflag & T_QUICK)); + MY_TEST(param.testflag & T_QUICK)); } else { thd_proc_info(thd, "Repair by sorting"); DEBUG_SYNC(thd, "myisam_before_repair_by_sort"); error = mi_repair_by_sort(¶m, file, fixed_name, - test(param.testflag & T_QUICK)); + MY_TEST(param.testflag & T_QUICK)); } if (error && file->create_unique_index_by_sort && share->state.dupp_key != MAX_KEY) @@ -1150,7 +1150,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) thd_proc_info(thd, "Repair with keycache"); param.testflag &= ~T_REP_BY_SORT; error= mi_repair(¶m, file, fixed_name, - test(param.testflag & T_QUICK)); + MY_TEST(param.testflag & T_QUICK)); } param.testflag= testflag | (param.testflag & T_RETRY_WITHOUT_QUICK); #ifdef HAVE_MMAP @@ -1562,7 +1562,7 @@ void ha_myisam::start_bulk_insert(ha_rows rows, uint flags) } else { - my_bool all_keys= test(flags & HA_CREATE_UNIQUE_INDEX_BY_SORT); + my_bool all_keys= MY_TEST(flags & HA_CREATE_UNIQUE_INDEX_BY_SORT); mi_disable_indexes_for_rebuild(file, rows, all_keys); } } diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index a44a6236293..b3c9355cb8b 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1147,7 +1147,7 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) if (param->testflag & (T_EXTEND | T_MEDIUM | T_VERBOSE)) { if (_mi_rec_check(info,record, info->rec_buff,block_info.rec_len, - test(info->s->calc_checksum))) + MY_TEST(info->s->calc_checksum))) { mi_check_print_error(param,"Found wrong packed record at %s", llstr(start_recpos,llbuff)); @@ -2364,7 +2364,7 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info, if (keyseg[i].flag & HA_SPACE_PACK) sort_param.key_length+=get_pack_length(keyseg[i].length); if (keyseg[i].flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART)) - sort_param.key_length+=2 + test(keyseg[i].length >= 127); + sort_param.key_length+= 2 + MY_TEST(keyseg[i].length >= 127); if (keyseg[i].flag & HA_NULL_PART) sort_param.key_length++; } @@ -2866,7 +2866,7 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info, if (keyseg->flag & HA_SPACE_PACK) sort_param[i].key_length+=get_pack_length(keyseg->length); if (keyseg->flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART)) - sort_param[i].key_length+=2 + test(keyseg->length >= 127); + sort_param[i].key_length+= 2 + MY_TEST(keyseg->length >= 127); if (keyseg->flag & HA_NULL_PART) sort_param[i].key_length++; } @@ -2884,7 +2884,7 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info, sort_info.total_keys=i; sort_param[0].master= 1; sort_param[0].fix_datafile= (my_bool)(! rep_quick); - sort_param[0].calc_checksum= test(param->testflag & T_CALC_CHECKSUM); + sort_param[0].calc_checksum= MY_TEST(param->testflag & T_CALC_CHECKSUM); if (!ftparser_alloc_param(info)) goto err; @@ -3573,7 +3573,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) sort_param->find_length, (param->testflag & T_QUICK) && sort_param->calc_checksum && - test(info->s->calc_checksum))) + MY_TEST(info->s->calc_checksum))) { mi_check_print_info(param,"Found wrong packed record at %s", llstr(sort_param->start_recpos,llbuff)); @@ -3734,7 +3734,7 @@ int sort_write_record(MI_SORT_PARAM *sort_param) do { - block_length=reclength+ 3 + test(reclength >= (65520-3)); + block_length= reclength + 3 + MY_TEST(reclength >= (65520 - 3)); if (block_length < share->base.min_block_length) block_length=share->base.min_block_length; info->update|=HA_STATE_WRITE_AT_END; @@ -4661,7 +4661,7 @@ static ha_checksum mi_byte_checksum(const uchar *buf, uint length) const uchar *end=buf+length; for (crc=0; buf != end; buf++) crc=((crc << 1) + *((uchar*) buf)) + - test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1))); + MY_TEST(crc & (((ha_checksum) 1) << (8 * sizeof(ha_checksum) - 1))); return crc; } diff --git a/storage/myisam/mi_checksum.c b/storage/myisam/mi_checksum.c index e0a8672760d..01adae3edac 100644 --- a/storage/myisam/mi_checksum.c +++ b/storage/myisam/mi_checksum.c @@ -23,7 +23,7 @@ ha_checksum mi_checksum(MI_INFO *info, const uchar *buf) const uchar *record= buf; MI_COLUMNDEF *column= info->s->rec; MI_COLUMNDEF *column_end= column+ info->s->base.fields; - my_bool skip_null_bits= test(info->s->options & HA_OPTION_NULL_FIELDS); + my_bool skip_null_bits= MY_TEST(info->s->options & HA_OPTION_NULL_FIELDS); for ( ; column != column_end ; buf+= column++->length) { diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index 4de218864de..88b9da6f8a9 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -138,7 +138,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, pack_reclength++; min_pack_length++; /* We must test for 257 as length includes pack-length */ - if (test(rec->length >= 257)) + if (MY_TEST(rec->length >= 257)) { long_varchar_count++; pack_reclength+= 2; /* May be packed on 3 bytes */ @@ -205,7 +205,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, pack_bytes= (packed+7)/8; if (pack_reclength != INT_MAX32) pack_reclength+= reclength+packed + - test(test_all_bits(options, HA_OPTION_CHECKSUM | HA_OPTION_PACK_RECORD)); + MY_TEST(test_all_bits(options, HA_OPTION_CHECKSUM | + HA_OPTION_PACK_RECORD)); min_pack_length+= pack_bytes; if (!ci->data_file_length && ci->max_rows) @@ -557,7 +558,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, share.base.records=ci->max_rows; share.base.reloc= ci->reloc_rows; share.base.reclength=real_reclength; - share.base.pack_reclength=reclength+ test(options & HA_OPTION_CHECKSUM); + share.base.pack_reclength= reclength + MY_TEST(options & HA_OPTION_CHECKSUM); share.base.max_pack_length=pack_reclength; share.base.min_pack_length=min_pack_length; share.base.pack_bits= pack_bytes; diff --git a/storage/myisam/mi_delete.c b/storage/myisam/mi_delete.c index 907d8e291f6..3fffa55341b 100644 --- a/storage/myisam/mi_delete.c +++ b/storage/myisam/mi_delete.c @@ -353,8 +353,8 @@ static int d_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, DBUG_RETURN(-1); } /* Page will be update later if we return 1 */ - DBUG_RETURN(test(length <= (info->quick_mode ? MI_MIN_KEYBLOCK_LENGTH : - (uint) keyinfo->underflow_block_length))); + DBUG_RETURN(MY_TEST(length <= (info->quick_mode ? MI_MIN_KEYBLOCK_LENGTH : + (uint) keyinfo->underflow_block_length))); } save_flag=1; ret_value=del(info,keyinfo,key,anc_buff,leaf_page,leaf_buff,keypos, diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 021809ed892..5241d72014c 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -416,7 +416,7 @@ static int _mi_find_writepos(MI_INFO *info, { /* No deleted blocks; Allocate a new block */ *filepos=info->state->data_file_length; - if ((tmp=reclength+3 + test(reclength >= (65520-3))) < + if ((tmp= reclength + 3 + MY_TEST(reclength >= (65520 - 3))) < info->s->base.min_block_length) tmp= info->s->base.min_block_length; else @@ -864,7 +864,7 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record, if (length < reclength) { uint tmp=MY_ALIGN(reclength - length + 3 + - test(reclength >= 65520L),MI_DYN_ALIGN_SIZE); + MY_TEST(reclength >= 65520L), MI_DYN_ALIGN_SIZE); /* Don't create a block bigger than MI_MAX_BLOCK_LENGTH */ tmp= MY_MIN(length+tmp, MI_MAX_BLOCK_LENGTH)-length; /* Check if we can extend this block */ @@ -1025,7 +1025,7 @@ uint _mi_rec_pack(MI_INFO *info, register uchar *to, pos++; } new_length=(uint) (end-pos); - if (new_length +1 + test(rec->length > 255 && new_length > 127) + if (new_length + 1 + MY_TEST(rec->length > 255 && new_length > 127) < length) { if (rec->length > 255 && new_length > 127) @@ -1145,7 +1145,7 @@ my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *rec_buff, pos++; } new_length=(uint) (end-pos); - if (new_length +1 + test(rec->length > 255 && new_length > 127) + if (new_length + 1 + MY_TEST(rec->length > 255 && new_length > 127) < length) { if (!(flag & bit)) @@ -1197,7 +1197,7 @@ my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *rec_buff, else to+= length; } - if (packed_length != (uint) (to - rec_buff) + test(info->s->calc_checksum) || + if (packed_length != (uint) (to - rec_buff) + MY_TEST(info->s->calc_checksum) || (bit != 1 && (flag & ~(bit - 1)))) goto err; if (with_checksum && ((uchar) info->checksum != (uchar) *to)) diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index f57fba5c2c5..a47c1987e38 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -56,7 +56,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) { reinit_io_cache(&info->rec_cache,READ_CACHE,0, (pbool) (info->lock_type != F_UNLCK), - (pbool) test(info->update & HA_STATE_ROW_CHANGED) + (pbool) MY_TEST(info->update & HA_STATE_ROW_CHANGED) ); } info->update= ((info->update & HA_STATE_CHANGED) | HA_STATE_NEXT_FOUND | @@ -117,7 +117,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) { reinit_io_cache(&info->rec_cache,READ_CACHE,info->nextpos, (pbool) (info->lock_type != F_UNLCK), - (pbool) test(info->update & HA_STATE_ROW_CHANGED)); + (pbool) MY_TEST(info->update & HA_STATE_ROW_CHANGED)); info->update&= ~HA_STATE_ROW_CHANGED; if (share->concurrent_insert) info->rec_cache.end_of_file=info->state->data_file_length; diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c index 663a226d850..531b800c63e 100644 --- a/storage/myisam/mi_locking.c +++ b/storage/myisam/mi_locking.c @@ -646,7 +646,7 @@ int _mi_decrement_open_count(MI_INFO *info) if (!lock_error && !my_disable_locking) lock_error=mi_lock_database(info,old_lock); } - return test(lock_error || write_error); + return MY_TEST(lock_error || write_error); } diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index f8213b1a3a5..c6af5195f82 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -523,9 +523,9 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) info.s=share; if (_mi_read_pack_info(&info, (pbool) - test(!(share->options & - (HA_OPTION_PACK_RECORD | - HA_OPTION_TEMP_COMPRESS_RECORD))))) + MY_TEST(!(share->options & + (HA_OPTION_PACK_RECORD | + HA_OPTION_TEMP_COMPRESS_RECORD))))) goto err; } else if (share->options & HA_OPTION_PACK_RECORD) diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index 01fa10de7a3..3ce112f7906 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -83,7 +83,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, } if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff, - test(!(nextflag & SEARCH_SAVE_BUFF))))) + MY_TEST(!(nextflag & SEARCH_SAVE_BUFF))))) goto err; DBUG_DUMP("page", buff, mi_getint(buff)); @@ -129,7 +129,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, { uchar *old_buff=buff; if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff, - test(!(nextflag & SEARCH_SAVE_BUFF))))) + MY_TEST(!(nextflag & SEARCH_SAVE_BUFF))))) goto err; keypos=buff+(keypos-old_buff); maxpos=buff+(maxpos-old_buff); diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c index 9e4e1c46891..87cea2e5566 100644 --- a/storage/myisam/mi_test1.c +++ b/storage/myisam/mi_test1.c @@ -268,14 +268,14 @@ static int run_test(const char *filename) if (verbose || (flags[j] >= 1 || (error && my_errno != HA_ERR_KEY_NOT_FOUND))) printf("key: '%.*s' mi_rkey: %3d errno: %3d\n", - (int) key_length,key+test(null_fields),error,my_errno); + (int) key_length, key + MY_TEST(null_fields), error, my_errno); } else { error=mi_delete(file,read_record); if (verbose || error) printf("key: '%.*s' mi_delete: %3d errno: %3d\n", - (int) key_length, key+test(null_fields), error, my_errno); + (int) key_length, key + MY_TEST(null_fields), error, my_errno); if (! error) { deleted++; @@ -296,7 +296,8 @@ static int run_test(const char *filename) (error && (flags[i] != 0 || my_errno != HA_ERR_KEY_NOT_FOUND))) { printf("key: '%.*s' mi_rkey: %3d errno: %3d record: %s\n", - (int) key_length,key+test(null_fields),error,my_errno,record+1); + (int) key_length, key + MY_TEST(null_fields), error, my_errno, + record + 1); } } diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 7ad35c92e6f..0cd01398cbc 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -814,7 +814,7 @@ static void get_options(register int *argc,register char ***argv) static int myisamchk(HA_CHECK *param, char * filename) { int error,lock_type,recreate; - int rep_quick= test(param->testflag & (T_QUICK | T_FORCE_UNIQUENESS)); + int rep_quick= MY_TEST(param->testflag & (T_QUICK | T_FORCE_UNIQUENESS)); MI_INFO *info; File datafile; char llbuff[22],llbuff2[22]; @@ -1128,7 +1128,8 @@ static int myisamchk(HA_CHECK *param, char * filename) if ((info->s->options & (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) || (param->testflag & (T_EXTEND | T_MEDIUM))) - error|=chk_data_link(param, info, test(param->testflag & T_EXTEND)); + error|= chk_data_link(param, info, + MY_TEST(param->testflag & T_EXTEND)); error|=flush_blocks(param, share->key_cache, share->kfile, &share->dirty_part_map); (void) end_io_cache(¶m->read_cache); @@ -1152,7 +1153,7 @@ static int myisamchk(HA_CHECK *param, char * filename) if ((param->testflag & T_AUTO_INC) || ((param->testflag & T_REP_ANY) && info->s->base.auto_key)) update_auto_increment_key(param, info, - (my_bool) !test(param->testflag & T_AUTO_INC)); + (my_bool) !MY_TEST(param->testflag & T_AUTO_INC)); if (!(param->testflag & T_DESCRIPT)) { diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 134ae372c8a..9b871f59a38 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -4393,12 +4393,12 @@ int ha_spider::read_multi_range_first_internal( #ifdef HA_MRR_USE_DEFAULT_IMPL (error_num = spider_db_append_key_where( &mrr_cur_range.start_key, - test(mrr_cur_range.range_flag & EQ_RANGE) ? + MY_TEST(mrr_cur_range.range_flag & EQ_RANGE) ? NULL : &mrr_cur_range.end_key, this)) #else (error_num = spider_db_append_key_where( &multi_range_curr->start_key, - test(multi_range_curr->range_flag & EQ_RANGE) ? + MY_TEST(multi_range_curr->range_flag & EQ_RANGE) ? NULL : &multi_range_curr->end_key, this)) #endif ) @@ -4834,9 +4834,9 @@ int ha_spider::read_multi_range_first_internal( !(sql_kinds & SPIDER_SQL_KIND_HS) && #endif #ifdef HA_MRR_USE_DEFAULT_IMPL - test(mrr_cur_range.range_flag & EQ_RANGE) + MY_TEST(mrr_cur_range.range_flag & EQ_RANGE) #else - test(multi_range_curr->range_flag & EQ_RANGE) + MY_TEST(multi_range_curr->range_flag & EQ_RANGE) #endif ) { if ( @@ -4951,11 +4951,11 @@ int ha_spider::read_multi_range_first_internal( { if ( #ifdef HA_MRR_USE_DEFAULT_IMPL - !test(mrr_cur_range.range_flag & EQ_RANGE) || + !MY_TEST(mrr_cur_range.range_flag & EQ_RANGE) || result_list.tmp_table_join_key_part_map != mrr_cur_range.start_key.keypart_map #else - !test(multi_range_curr->range_flag & EQ_RANGE) || + !MY_TEST(multi_range_curr->range_flag & EQ_RANGE) || result_list.tmp_table_join_key_part_map != multi_range_curr->start_key.keypart_map #endif @@ -5119,12 +5119,12 @@ int ha_spider::read_multi_range_first_internal( #ifdef HA_MRR_USE_DEFAULT_IMPL (error_num = spider_db_append_key_where( &mrr_cur_range.start_key, - test(mrr_cur_range.range_flag & EQ_RANGE) ? + MY_TEST(mrr_cur_range.range_flag & EQ_RANGE) ? NULL : &mrr_cur_range.end_key, this)) #else (error_num = spider_db_append_key_where( &multi_range_curr->start_key, - test(multi_range_curr->range_flag & EQ_RANGE) ? + MY_TEST(multi_range_curr->range_flag & EQ_RANGE) ? NULL : &multi_range_curr->end_key, this)) #endif ) @@ -5739,12 +5739,12 @@ int ha_spider::read_multi_range_next( #ifdef HA_MRR_USE_DEFAULT_IMPL (error_num = spider_db_append_key_where( &mrr_cur_range.start_key, - test(mrr_cur_range.range_flag & EQ_RANGE) ? + MY_TEST(mrr_cur_range.range_flag & EQ_RANGE) ? NULL : &mrr_cur_range.end_key, this)) #else (error_num = spider_db_append_key_where( &multi_range_curr->start_key, - test(multi_range_curr->range_flag & EQ_RANGE) ? + MY_TEST(multi_range_curr->range_flag & EQ_RANGE) ? NULL : &multi_range_curr->end_key, this)) #endif ) @@ -6193,9 +6193,9 @@ int ha_spider::read_multi_range_next( !(sql_kinds & SPIDER_SQL_KIND_HS) && #endif #ifdef HA_MRR_USE_DEFAULT_IMPL - test(mrr_cur_range.range_flag & EQ_RANGE) + MY_TEST(mrr_cur_range.range_flag & EQ_RANGE) #else - test(multi_range_curr->range_flag & EQ_RANGE) + MY_TEST(multi_range_curr->range_flag & EQ_RANGE) #endif ) { if ( @@ -6311,11 +6311,11 @@ int ha_spider::read_multi_range_next( { if ( #ifdef HA_MRR_USE_DEFAULT_IMPL - !test(mrr_cur_range.range_flag & EQ_RANGE) || + !MY_TEST(mrr_cur_range.range_flag & EQ_RANGE) || result_list.tmp_table_join_key_part_map != mrr_cur_range.start_key.keypart_map #else - !test(multi_range_curr->range_flag & EQ_RANGE) || + !MY_TEST(multi_range_curr->range_flag & EQ_RANGE) || result_list.tmp_table_join_key_part_map != multi_range_curr->start_key.keypart_map #endif @@ -6478,12 +6478,12 @@ int ha_spider::read_multi_range_next( #ifdef HA_MRR_USE_DEFAULT_IMPL (error_num = spider_db_append_key_where( &mrr_cur_range.start_key, - test(mrr_cur_range.range_flag & EQ_RANGE) ? + MY_TEST(mrr_cur_range.range_flag & EQ_RANGE) ? NULL : &mrr_cur_range.end_key, this)) #else (error_num = spider_db_append_key_where( &multi_range_curr->start_key, - test(multi_range_curr->range_flag & EQ_RANGE) ? + MY_TEST(multi_range_curr->range_flag & EQ_RANGE) ? NULL : &multi_range_curr->end_key, this)) #endif ) diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index cbcab362e8e..3cb00036098 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -1629,7 +1629,7 @@ static int initialize_key_and_col_info(TABLE_SHARE* table_share, TABLE* table, K } - for (uint i = 0; i < table_share->keys + test(hidden_primary_key); i++) { + for (uint i = 0; i < table_share->keys + MY_TEST(hidden_primary_key); i++) { // // do the cluster/primary key filtering calculations // @@ -1672,7 +1672,7 @@ exit: } bool ha_tokudb::can_replace_into_be_fast(TABLE_SHARE* table_share, KEY_AND_COL_INFO* kc_info, uint pk) { - uint curr_num_DBs = table_share->keys + test(hidden_primary_key); + uint curr_num_DBs = table_share->keys + MY_TEST(hidden_primary_key); bool ret_val; if (curr_num_DBs == 1) { ret_val = true; @@ -1860,7 +1860,7 @@ int ha_tokudb::initialize_share( share->try_table_lock = false; } - share->num_DBs = table_share->keys + test(hidden_primary_key); + share->num_DBs = table_share->keys + MY_TEST(hidden_primary_key); error = 0; exit: @@ -2935,7 +2935,7 @@ DBT *ha_tokudb::pack_key( { TOKUDB_DBUG_ENTER("ha_tokudb::pack_key"); #if TOKU_INCLUDE_EXTENDED_KEYS - if (keynr != primary_key && !test(hidden_primary_key)) { + if (keynr != primary_key && !MY_TEST(hidden_primary_key)) { DBUG_RETURN(pack_ext_key(key, keynr, buff, key_ptr, key_length, inf_byte)); } #endif @@ -3360,7 +3360,7 @@ void ha_tokudb::start_bulk_insert(ha_rows rows, uint flags) { abort_loader = false; rw_rdlock(&share->num_DBs_lock); - uint curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); num_DBs_locked_in_bulk = true; lock_count = 0; @@ -3875,7 +3875,7 @@ void ha_tokudb::set_main_dict_put_flags( ) { uint32_t old_prelock_flags = 0; - uint curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); bool in_hot_index = share->num_DBs > curr_num_DBs; bool using_ignore_flag_opt = do_ignore_flag_optimization( thd, table, share->replace_into_fast); @@ -3919,7 +3919,7 @@ int ha_tokudb::insert_row_to_main_dictionary(uchar* record, DBT* pk_key, DBT* pk int error = 0; uint32_t put_flags = mult_put_flags[primary_key]; THD *thd = ha_thd(); - uint curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); assert(curr_num_DBs == 1); @@ -4129,7 +4129,7 @@ int ha_tokudb::write_row(uchar * record) { // for #4633 // if we have a duplicate key error, let's check the primary key to see // if there is a duplicate there. If so, set last_dup_key to the pk - if (error == DB_KEYEXIST && !test(hidden_primary_key) && last_dup_key != primary_key) { + if (error == DB_KEYEXIST && !MY_TEST(hidden_primary_key) && last_dup_key != primary_key) { int r = share->file->getf_set( share->file, txn, @@ -5954,7 +5954,7 @@ int ha_tokudb::info(uint flag) { TOKUDB_DBUG_ENTER("ha_tokudb::info %p %d %lld", this, flag, (long long) share->rows); int error; DB_TXN* txn = NULL; - uint curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); DB_BTREE_STAT64 dict_stats; for (uint i=0; i < table->s->keys; i++) @@ -6461,7 +6461,7 @@ THR_LOCK_DATA **ha_tokudb::store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_l // if creating a hot index if (thd_sql_command(thd)== SQLCOM_CREATE_INDEX && get_create_index_online(thd)) { rw_rdlock(&share->num_DBs_lock); - if (share->num_DBs == (table->s->keys + test(hidden_primary_key))) { + if (share->num_DBs == (table->s->keys + MY_TEST(hidden_primary_key))) { lock_type = TL_WRITE_ALLOW_WRITE; } lock.type = lock_type; @@ -7690,7 +7690,7 @@ int ha_tokudb::tokudb_add_index( // // number of DB files we have open currently, before add_index is executed // - uint curr_num_DBs = table_arg->s->keys + test(hidden_primary_key); + uint curr_num_DBs = table_arg->s->keys + MY_TEST(hidden_primary_key); // // get the row type to use for the indexes we're adding @@ -8030,7 +8030,7 @@ To add indexes, make sure no transactions touch the table.", share->table_name); // Closes added indexes in case of error in error path of add_index and alter_table_phase2 // void ha_tokudb::restore_add_index(TABLE* table_arg, uint num_of_keys, bool incremented_numDBs, bool modified_DBs) { - uint curr_num_DBs = table_arg->s->keys + test(hidden_primary_key); + uint curr_num_DBs = table_arg->s->keys + MY_TEST(hidden_primary_key); uint curr_index = 0; // @@ -8251,7 +8251,7 @@ int ha_tokudb::delete_all_rows_internal() { error = txn_begin(db_env, 0, &txn, 0, ha_thd()); if (error) { goto cleanup; } - curr_num_DBs = table->s->keys + test(hidden_primary_key); + curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); for (uint i = 0; i < curr_num_DBs; i++) { error = share->key_file[i]->pre_acquire_fileops_lock( share->key_file[i], diff --git a/storage/tokudb/ha_tokudb_admin.cc b/storage/tokudb/ha_tokudb_admin.cc index 4b6aaed551d..5139bb713ce 100644 --- a/storage/tokudb/ha_tokudb_admin.cc +++ b/storage/tokudb/ha_tokudb_admin.cc @@ -200,7 +200,7 @@ int ha_tokudb::optimize(THD * thd, HA_CHECK_OPT * check_opt) { while (ha_tokudb_optimize_wait) sleep(1); // debug int error; - uint curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); #ifdef HA_TOKUDB_HAS_THD_PROGRESS // each DB is its own stage. as HOT goes through each db, we'll @@ -289,7 +289,7 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) { if (r != 0) result = HA_ADMIN_INTERNAL_ERROR; if (result == HA_ADMIN_OK) { - uint32_t num_DBs = table_share->keys + test(hidden_primary_key); + uint32_t num_DBs = table_share->keys + MY_TEST(hidden_primary_key); snprintf(write_status_msg, sizeof write_status_msg, "%s primary=%d num=%d", share->table_name, primary_key, num_DBs); if (tokudb_debug & TOKUDB_DEBUG_CHECK) { ha_tokudb_check_info(thd, table, write_status_msg); diff --git a/storage/tokudb/ha_tokudb_alter_56.cc b/storage/tokudb/ha_tokudb_alter_56.cc index a337b9be93a..77b05f1412d 100644 --- a/storage/tokudb/ha_tokudb_alter_56.cc +++ b/storage/tokudb/ha_tokudb_alter_56.cc @@ -471,7 +471,7 @@ bool ha_tokudb::inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha // Set the new compression enum toku_compression_method method = row_type_to_compression_method((srv_row_format_t)create_info->option_struct->row_format); - uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint32_t curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); for (uint32_t i = 0; i < curr_num_DBs; i++) { db = share->key_file[i]; error = db->change_compression_method(db, method); @@ -594,7 +594,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac uint32_t max_column_extra_size; uint32_t num_column_extra; uint32_t num_columns = 0; - uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint32_t curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); uint32_t columns[table->s->fields + altered_table->s->fields]; // set size such that we know it is big enough for both cases memset(columns, 0, sizeof(columns)); @@ -721,7 +721,7 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i restore_drop_indexes(table, index_drop_offsets, ha_alter_info->index_drop_count); } if (ctx->compression_changed) { - uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint32_t curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); for (uint32_t i = 0; i < curr_num_DBs; i++) { DB *db = share->key_file[i]; int error = db->change_compression_method(db, ctx->orig_compression_method); @@ -746,7 +746,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in int error = 0; tokudb_alter_ctx *ctx = static_cast<tokudb_alter_ctx *>(ha_alter_info->handler_ctx); - uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint32_t curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); for (uint32_t i = 0; i < curr_num_DBs; i++) { // change to a new descriptor DBT row_descriptor; memset(&row_descriptor, 0, sizeof row_descriptor); @@ -928,7 +928,7 @@ int ha_tokudb::alter_table_expand_one_column(TABLE *altered_table, Alter_inplace assert(0); } - uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint32_t curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); for (uint32_t i = 0; i < curr_num_DBs; i++) { // change to a new descriptor DBT row_descriptor; memset(&row_descriptor, 0, sizeof row_descriptor); @@ -1007,7 +1007,7 @@ int ha_tokudb::alter_table_expand_blobs(TABLE *altered_table, Alter_inplace_info int error = 0; tokudb_alter_ctx *ctx = static_cast<tokudb_alter_ctx *>(ha_alter_info->handler_ctx); - uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key); + uint32_t curr_num_DBs = table->s->keys + MY_TEST(hidden_primary_key); for (uint32_t i = 0; i < curr_num_DBs; i++) { // change to a new descriptor DBT row_descriptor; memset(&row_descriptor, 0, sizeof row_descriptor); diff --git a/storage/tokudb/ha_tokudb_update.cc b/storage/tokudb/ha_tokudb_update.cc index 94d687da67c..1316c7a105d 100644 --- a/storage/tokudb/ha_tokudb_update.cc +++ b/storage/tokudb/ha_tokudb_update.cc @@ -549,7 +549,7 @@ static bool is_strict_mode(THD *thd) { #if 50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699 return thd->is_strict_mode(); #else - return test(thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)); + return MY_TEST(thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)); #endif } @@ -837,7 +837,7 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update rw_rdlock(&share->num_DBs_lock); - if (share->num_DBs > table->s->keys + test(hidden_primary_key)) { // hot index in progress + if (share->num_DBs > table->s->keys + MY_TEST(hidden_primary_key)) { // hot index in progress error = ENOTSUP; // run on the slow path } else { // send the update message @@ -990,7 +990,7 @@ int ha_tokudb::send_upsert_message(THD *thd, List<Item> &update_fields, List<Ite rw_rdlock(&share->num_DBs_lock); - if (share->num_DBs > table->s->keys + test(hidden_primary_key)) { // hot index in progress + if (share->num_DBs > table->s->keys + MY_TEST(hidden_primary_key)) { // hot index in progress error = ENOTSUP; // run on the slow path } else { // send the upsert message diff --git a/strings/decimal.c b/strings/decimal.c index 6d39d9aec78..2156e095315 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -353,7 +353,7 @@ int decimal2string(const decimal_t *from, char *to, int *to_len, if (!(intg_len= fixed_precision ? fixed_intg : intg)) intg_len= 1; frac_len= fixed_precision ? fixed_decimals : frac; - len= from->sign + intg_len + test(frac) + frac_len; + len= from->sign + intg_len + MY_TEST(frac) + frac_len; if (fixed_precision) { if (frac > fixed_decimals) @@ -379,7 +379,7 @@ int decimal2string(const decimal_t *from, char *to, int *to_len, } else frac-=j; - len= from->sign + intg_len + test(frac) + frac_len; + len= from->sign + intg_len + MY_TEST(frac) + frac_len; } *to_len=len; s[len]=0; diff --git a/vio/vio.c b/vio/vio.c index ea95758f212..97e3d49be21 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -234,7 +234,7 @@ my_bool vio_reset(Vio* vio, enum enum_vio_type type, if (old_vio.write_timeout >= 0) ret|= vio_timeout(vio, 1, old_vio.write_timeout); - DBUG_RETURN(test(ret)); + DBUG_RETURN(MY_TEST(ret)); } diff --git a/vio/viosocket.c b/vio/viosocket.c index 892783d2ac4..5576dfc48d8 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -362,7 +362,7 @@ int vio_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode) #endif DBUG_ENTER("vio_blocking"); - *old_mode= test(!(vio->fcntl_mode & O_NONBLOCK)); + *old_mode= MY_TEST(!(vio->fcntl_mode & O_NONBLOCK)); DBUG_PRINT("enter", ("set_blocking_mode: %d old_mode: %d", (int) set_blocking_mode, (int) *old_mode)); @@ -407,7 +407,7 @@ int vio_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode) r = ioctlsocket(sd,FIONBIO,(void*) &arg); } else - r= test(!(vio->fcntl_mode & O_NONBLOCK)) != set_blocking_mode; + r= MY_TEST(!(vio->fcntl_mode & O_NONBLOCK)) != set_blocking_mode; #endif /* !defined(__WIN__) */ DBUG_PRINT("exit", ("%d", r)); DBUG_RETURN(r); @@ -1060,16 +1060,16 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout) switch (event) { case VIO_IO_EVENT_READ: - ret= test(FD_ISSET(fd, &readfds)); + ret= MY_TEST(FD_ISSET(fd, &readfds)); break; case VIO_IO_EVENT_WRITE: case VIO_IO_EVENT_CONNECT: - ret= test(FD_ISSET(fd, &writefds)); + ret= MY_TEST(FD_ISSET(fd, &writefds)); break; } /* Error conditions pending? */ - ret|= test(FD_ISSET(fd, &exceptfds)); + ret|= MY_TEST(FD_ISSET(fd, &exceptfds)); /* Not a timeout, ensure that a condition was met. */ DBUG_ASSERT(ret); @@ -1154,7 +1154,7 @@ vio_socket_connect(Vio *vio, struct sockaddr *addr, socklen_t len, int timeout) #else errno= error; #endif - ret= test(error); + ret= MY_TEST(error); } } @@ -1166,7 +1166,7 @@ vio_socket_connect(Vio *vio, struct sockaddr *addr, socklen_t len, int timeout) DBUG_RETURN(TRUE); } - DBUG_RETURN(test(ret)); + DBUG_RETURN(MY_TEST(ret)); } |