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++.
This commit is contained in:
Sergey Vojtovich 2014-02-19 14:05:15 +04:00
parent fd1437dfe5
commit d12c7adf71
133 changed files with 600 additions and 585 deletions

View File

@ -1047,7 +1047,7 @@ int main(int argc, char **argv)
for (i = 0; i < alter_table_cmds.elements ; i++) for (i = 0; i < alter_table_cmds.elements ; i++)
run_query((char*) dynamic_array_ptr(&alter_table_cmds, i)); run_query((char*) dynamic_array_ptr(&alter_table_cmds, i));
} }
ret= test(first_error); ret= MY_TEST(first_error);
end: end:
dbDisconnect(current_host); dbDisconnect(current_host);

View File

@ -69,8 +69,8 @@ extern "C" {
#if MARIA_MAX_KEY > MARIA_KEYMAP_BITS #if MARIA_MAX_KEY > MARIA_KEYMAP_BITS
#define maria_is_key_active(_keymap_,_keyno_) \ #define maria_is_key_active(_keymap_,_keyno_) \
(((_keyno_) < MARIA_KEYMAP_BITS) ? \ (((_keyno_) < MARIA_KEYMAP_BITS) ? \
test((_keymap_) & (1ULL << (_keyno_))) : \ MY_TEST((_keymap_) & (1ULL << (_keyno_))) : \
test((_keymap_) & MARIA_KEYMAP_HIGH_MASK)) MY_TEST((_keymap_) & MARIA_KEYMAP_HIGH_MASK))
#define maria_set_key_active(_keymap_,_keyno_) \ #define maria_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (((_keyno_) < MARIA_KEYMAP_BITS) ? \ (_keymap_)|= (((_keyno_) < MARIA_KEYMAP_BITS) ? \
(1ULL << (_keyno_)) : \ (1ULL << (_keyno_)) : \
@ -81,14 +81,14 @@ extern "C" {
(~ (0ULL)) /*ignore*/ ) (~ (0ULL)) /*ignore*/ )
#else #else
#define maria_is_key_active(_keymap_,_keyno_) \ #define maria_is_key_active(_keymap_,_keyno_) \
test((_keymap_) & (1ULL << (_keyno_))) MY_TEST((_keymap_) & (1ULL << (_keyno_)))
#define maria_set_key_active(_keymap_,_keyno_) \ #define maria_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (1ULL << (_keyno_)) (_keymap_)|= (1ULL << (_keyno_))
#define maria_clear_key_active(_keymap_,_keyno_) \ #define maria_clear_key_active(_keymap_,_keyno_) \
(_keymap_)&= (~ (1ULL << (_keyno_))) (_keymap_)&= (~ (1ULL << (_keyno_)))
#endif #endif
#define maria_is_any_key_active(_keymap_) \ #define maria_is_any_key_active(_keymap_) \
test((_keymap_)) MY_TEST((_keymap_))
#define maria_is_all_keys_active(_keymap_,_keys_) \ #define maria_is_all_keys_active(_keymap_,_keys_) \
((_keymap_) == maria_get_mask_all_keys_active(_keys_)) ((_keymap_) == maria_get_mask_all_keys_active(_keys_))
#define maria_set_all_keys_active(_keymap_,_keys_) \ #define maria_set_all_keys_active(_keymap_,_keys_) \

View File

@ -474,7 +474,7 @@ typedef unsigned short ushort;
#endif #endif
#define swap_variables(t, a, b) do { t dummy; dummy= a; a= b; b= dummy; } while(0) #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_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_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)) #define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))

View File

@ -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_WARNINGS (MYSQL_TIME_WARN_TRUNCATED|MYSQL_TIME_WARN_OUT_OF_RANGE)
#define MYSQL_TIME_WARN_NOTES (MYSQL_TIME_NOTE_TRUNCATED) #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_WARNINGS(x) MY_TEST((x) & MYSQL_TIME_WARN_WARNINGS)
#define MYSQL_TIME_WARN_HAVE_NOTES(x) test((x) & MYSQL_TIME_WARN_NOTES) #define MYSQL_TIME_WARN_HAVE_NOTES(x) MY_TEST((x) & MYSQL_TIME_WARN_NOTES)
/* Limits for the TIME data type */ /* Limits for the TIME data type */
#define TIME_MAX_HOUR 838 #define TIME_MAX_HOUR 838

View File

@ -68,8 +68,8 @@ extern "C" {
#define mi_is_key_active(_keymap_,_keyno_) \ #define mi_is_key_active(_keymap_,_keyno_) \
(((_keyno_) < MI_KEYMAP_BITS) ? \ (((_keyno_) < MI_KEYMAP_BITS) ? \
test((_keymap_) & (1ULL << (_keyno_))) : \ MY_TEST((_keymap_) & (1ULL << (_keyno_))) : \
test((_keymap_) & MI_KEYMAP_HIGH_MASK)) MY_TEST((_keymap_) & MI_KEYMAP_HIGH_MASK))
#define mi_set_key_active(_keymap_,_keyno_) \ #define mi_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \ (_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \
(1ULL << (_keyno_)) : \ (1ULL << (_keyno_)) : \
@ -82,7 +82,7 @@ extern "C" {
#else #else
#define mi_is_key_active(_keymap_,_keyno_) \ #define mi_is_key_active(_keymap_,_keyno_) \
test((_keymap_) & (1ULL << (_keyno_))) MY_TEST((_keymap_) & (1ULL << (_keyno_)))
#define mi_set_key_active(_keymap_,_keyno_) \ #define mi_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (1ULL << (_keyno_)) (_keymap_)|= (1ULL << (_keyno_))
#define mi_clear_key_active(_keymap_,_keyno_) \ #define mi_clear_key_active(_keymap_,_keyno_) \
@ -91,7 +91,7 @@ extern "C" {
#endif #endif
#define mi_is_any_key_active(_keymap_) \ #define mi_is_any_key_active(_keymap_) \
test((_keymap_)) MY_TEST((_keymap_))
#define mi_is_all_keys_active(_keymap_,_keys_) \ #define mi_is_all_keys_active(_keymap_,_keys_) \
((_keymap_) == mi_get_mask_all_keys_active(_keys_)) ((_keymap_) == mi_get_mask_all_keys_active(_keys_))
#define mi_set_all_keys_active(_keymap_,_keys_) \ #define mi_set_all_keys_active(_keymap_,_keys_) \

View File

@ -2083,7 +2083,7 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
buff[4]= (char) stmt->flags; buff[4]= (char) stmt->flags;
int4store(buff+5, 1); /* iteration count */ int4store(buff+5, 1); /* iteration count */
res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), res= MY_TEST(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
(uchar*) packet, length, 1, stmt) || (uchar*) packet, length, 1, stmt) ||
(*mysql->methods->read_query_result)(mysql)); (*mysql->methods->read_query_result)(mysql));
stmt->affected_rows= mysql->affected_rows; stmt->affected_rows= mysql->affected_rows;
@ -2571,7 +2571,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
reinit_result_set_metadata(stmt); reinit_result_set_metadata(stmt);
prepare_to_fetch_result(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); double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err);
float fdata= (float) data; float fdata= (float) data;
*param->error= (fdata != data) | test(err); *param->error= (fdata != data) | MY_TEST(err);
floatstore(buffer, fdata); floatstore(buffer, fdata);
break; break;
} }
case MYSQL_TYPE_DOUBLE: case MYSQL_TYPE_DOUBLE:
{ {
double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err); double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err);
*param->error= test(err); *param->error= MY_TEST(err);
doublestore(buffer, data); doublestore(buffer, data);
break; break;
} }
@ -3204,7 +3204,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
MYSQL_TIME_STATUS status; MYSQL_TIME_STATUS status;
str_to_time(value, length, tm, 0, &status); str_to_time(value, length, tm, 0, &status);
err= status.warnings; err= status.warnings;
*param->error= test(err); *param->error= MY_TEST(err);
break; break;
} }
case MYSQL_TYPE_DATE: case MYSQL_TYPE_DATE:
@ -3215,7 +3215,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
MYSQL_TIME_STATUS status; MYSQL_TIME_STATUS status;
(void) str_to_datetime(value, length, tm, 0, &status); (void) str_to_datetime(value, length, tm, 0, &status);
err= status.warnings; err= status.warnings;
*param->error= test(err) && (param->buffer_type == MYSQL_TYPE_DATE && *param->error= MY_TEST(err) && (param->buffer_type == MYSQL_TYPE_DATE &&
tm->time_type != MYSQL_TIMESTAMP_DATE); tm->time_type != MYSQL_TIMESTAMP_DATE);
break; break;
} }
@ -3338,7 +3338,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
{ {
int error; int error;
value= number_to_datetime(value, 0, (MYSQL_TIME *) buffer, 0, &error); value= number_to_datetime(value, 0, (MYSQL_TIME *) buffer, 0, &error);
*param->error= test(error); *param->error= MY_TEST(error);
break; break;
} }
default: 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, static void fetch_result_tinyint(MYSQL_BIND *param, MYSQL_FIELD *field,
uchar **row) 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 data= **row;
*(uchar *)param->buffer= data; *(uchar *)param->buffer= data;
*param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX8; *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, static void fetch_result_short(MYSQL_BIND *param, MYSQL_FIELD *field,
uchar **row) 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); ushort data= (ushort) sint2korr(*row);
shortstore(param->buffer, data); shortstore(param->buffer, data);
*param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX16; *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)), MYSQL_FIELD *field __attribute__((unused)),
uchar **row) 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); uint32 data= (uint32) sint4korr(*row);
longstore(param->buffer, data); longstore(param->buffer, data);
*param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX32; *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)), MYSQL_FIELD *field __attribute__((unused)),
uchar **row) 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); ulonglong data= (ulonglong) sint8korr(*row);
*param->error= param->is_unsigned != field_is_unsigned && data > LONGLONG_MAX; *param->error= param->is_unsigned != field_is_unsigned && data > LONGLONG_MAX;
longlongstore(param->buffer, data); longlongstore(param->buffer, data);
@ -4711,7 +4711,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
my_free(stmt->extension); my_free(stmt->extension);
my_free(stmt); my_free(stmt);
DBUG_RETURN(test(rc)); DBUG_RETURN(MY_TEST(rc));
} }
/* /*

View File

@ -332,7 +332,7 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
thd->client_param_count= stmt->param_count; thd->client_param_count= stmt->param_count;
thd->client_params= stmt->params; thd->client_params= stmt->params;
res= test(emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE, 0, 0, res= MY_TEST(emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE, 0, 0,
header, sizeof(header), 1, stmt) || header, sizeof(header), 1, stmt) ||
emb_read_query_result(stmt->mysql)); emb_read_query_result(stmt->mysql));
stmt->affected_rows= stmt->mysql->affected_rows; stmt->affected_rows= stmt->mysql->affected_rows;

View File

@ -117,7 +117,7 @@ my_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN *str)
{ {
if (str->length < 1) if (str->length < 1)
return FALSE; 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 static enum enum_dyncol_func_result

View File

@ -179,7 +179,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
DBUG_ASSERT(seek_offset == 0); DBUG_ASSERT(seek_offset == 0);
} }
else else
info->seek_not_done= test(seek_offset != pos); info->seek_not_done= MY_TEST(seek_offset != pos);
} }
info->disk_writes= 0; info->disk_writes= 0;

View File

@ -5651,7 +5651,7 @@ int flush_partitioned_key_cache_blocks(PARTITIONED_KEY_CACHE_CB *keycache,
if ((type == FLUSH_KEEP || type == FLUSH_FORCE_WRITE) && if ((type == FLUSH_KEEP || type == FLUSH_FORCE_WRITE) &&
!((*dirty_part_map) & ((ulonglong) 1 << i))) !((*dirty_part_map) & ((ulonglong) 1 << i)))
continue; 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; *dirty_part_map= 0;

View File

@ -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->free= mem_root->used= mem_root->pre_alloc= 0;
mem_root->min_malloc= 32; mem_root->min_malloc= 32;
mem_root->block_size= (block_size - ALLOC_ROOT_MIN_BLOCK_SIZE) & ~1; 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->block_size|= 1;
mem_root->error_handler= 0; mem_root->error_handler= 0;

View File

@ -66,7 +66,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
from_file=to_file= -1; from_file=to_file= -1;
DBUG_ASSERT(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */ DBUG_ASSERT(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */
if (MyFlags & MY_HOLD_ORIGINAL_MODES) /* Copy stat if possible */ 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) if ((from_file=my_open(from,O_RDONLY | O_SHARE,MyFlags)) >= 0)
{ {

View File

@ -157,12 +157,12 @@ int test_if_hard_path(register const char *dir_name)
my_bool has_path(const char *name) my_bool has_path(const char *name)
{ {
return test(strchr(name, FN_LIBCHAR)) return MY_TEST(strchr(name, FN_LIBCHAR))
#if FN_LIBCHAR != '/' #if FN_LIBCHAR != '/'
|| test(strchr(name,'/')) || MY_TEST(strchr(name, '/'))
#endif #endif
#ifdef FN_DEVCHAR #ifdef FN_DEVCHAR
|| test(strchr(name, FN_DEVCHAR)) || MY_TEST(strchr(name, FN_DEVCHAR))
#endif #endif
; ;
} }

View File

@ -112,9 +112,10 @@ void *my_malloc(size_t size, myf my_flags)
} }
else 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, 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", DBUG_EXECUTE_IF("simulate_out_of_memory",
{ {
/* my_free() handles memory accounting */ /* 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 Test that the new and old area are the same, if not MY_THREAD_MOVE is
given 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)); (my_flags & MY_THREAD_MOVE));
if ((point= sf_realloc(MALLOC_FIX_POINTER_FOR_FREE(oldpoint), if ((point= sf_realloc(MALLOC_FIX_POINTER_FOR_FREE(oldpoint),
size + MALLOC_PREFIX_SIZE, my_flags)) == NULL) size + MALLOC_PREFIX_SIZE, my_flags)) == NULL)
@ -177,13 +178,14 @@ void *my_realloc(void *oldpoint, size_t size, myf my_flags)
} }
else else
{ {
MALLOC_STORE_SIZE(point, void*, size, test(my_flags & MY_THREAD_SPECIFIC)); MALLOC_STORE_SIZE(point, void*, size,
if (test(my_flags & MY_THREAD_SPECIFIC) != old_flags) MY_TEST(my_flags & MY_THREAD_SPECIFIC));
if (MY_TEST(my_flags & MY_THREAD_SPECIFIC) != old_flags)
{ {
/* memory moved between system and thread specific */ /* memory moved between system and thread specific */
update_malloc_size(-(longlong) old_size - MALLOC_PREFIX_SIZE, old_flags); update_malloc_size(-(longlong) old_size - MALLOC_PREFIX_SIZE, old_flags);
update_malloc_size((longlong) size + MALLOC_PREFIX_SIZE, update_malloc_size((longlong) size + MALLOC_PREFIX_SIZE,
test(my_flags & MY_THREAD_SPECIFIC)); MY_TEST(my_flags & MY_THREAD_SPECIFIC));
} }
else else
update_malloc_size((longlong)size - (longlong)old_size, old_flags); update_malloc_size((longlong)size - (longlong)old_size, old_flags);

View File

@ -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; struct st_irem *irem= (struct st_irem *)ptr - 1;
DBUG_ENTER("sf_malloc_usable_size"); 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, DBUG_PRINT("exit", ("size: %lu flags: %lu", (ulong) irem->datasize,
(ulong)irem->flags)); (ulong)irem->flags));
DBUG_RETURN(irem->datasize); DBUG_RETURN(irem->datasize);

View File

@ -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->offset_to_key=0; /* use key through pointer */
tree->size_of_element+=sizeof(void*); 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)); 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; tree->mem_root.min_malloc= sizeof(TREE_ELEMENT)+tree->size_of_element;

View File

@ -1426,7 +1426,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
options->secure_auth= TRUE; options->secure_auth= TRUE;
break; break;
case OPT_report_data_truncation: 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; break;
case OPT_plugin_dir: 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 */ mysql->options.protocol=MYSQL_PROTOCOL_PIPE; /* Force named pipe */
break; break;
case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/ 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; mysql->options.client_flag|= CLIENT_LOCAL_FILES;
else else
mysql->options.client_flag&= ~CLIENT_LOCAL_FILES; 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; mysql->options.secure_auth= *(my_bool *) arg;
break; break;
case MYSQL_REPORT_DATA_TRUNCATION: 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; break;
case MYSQL_OPT_RECONNECT: case MYSQL_OPT_RECONNECT:
mysql->reconnect= *(my_bool *) arg; mysql->reconnect= *(my_bool *) arg;

View File

@ -474,7 +474,7 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
end: end:
event_table->file->ha_index_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->mdl_context.rollback_to_savepoint(mdl_savepoint);
thd->variables.sql_mode= saved_mode; 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->mdl_context.rollback_to_savepoint(mdl_savepoint);
thd->variables.sql_mode= saved_mode; thd->variables.sql_mode= saved_mode;
DBUG_RETURN(test(ret)); DBUG_RETURN(MY_TEST(ret));
} }
@ -921,7 +921,7 @@ end:
close_thread_tables(thd); close_thread_tables(thd);
thd->mdl_context.rollback_to_savepoint(mdl_savepoint); 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); 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); close_mysql_tables(thd);
} }
DBUG_RETURN(test(ret)); DBUG_RETURN(MY_TEST(ret));
} }
/** /**

View File

@ -1774,7 +1774,7 @@ int Field_num::store_decimal(const my_decimal *val)
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED; ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
int err= 0; int err= 0;
longlong i= convert_decimal2longlong(val, unsigned_flag, &err); 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) 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; int err= 0;
longlong i= convert_decimal2longlong(val, 1, &err); 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 || if (param_data == 0 ||
((from_bit_len == bit_len) && (from_len == bytes_in_rec))) ((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 return 0; // Error in data
if (bit_len > 0) if (bit_len > 0)
@ -8931,7 +8931,7 @@ void Create_field::create_length_to_internal_length(void)
{ {
pack_length= length / 8; pack_length= length / 8;
/* We need one extra byte to store the bits we save among the null bits */ /* 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; break;
case MYSQL_TYPE_NEWDECIMAL: case MYSQL_TYPE_NEWDECIMAL:

View File

@ -67,7 +67,7 @@ enum Derivation
#define MY_REPERTOIRE_NUMERIC MY_REPERTOIRE_ASCII #define MY_REPERTOIRE_NUMERIC MY_REPERTOIRE_ASCII
/* The length of the header part for each virtual column in the .frm file */ /* 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; class Count_distinct_field;
@ -616,7 +616,7 @@ public:
null_ptr[row_offset]. null_ptr[row_offset].
*/ */
return (table->null_row ? TRUE : 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 inline bool is_real_null(my_ptrdiff_t row_offset= 0) const
{ return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : 0; } { return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : 0; }
@ -624,8 +624,7 @@ public:
{ {
if (!null_ptr) if (!null_ptr)
return 0; return 0;
return test(record[(uint) (null_ptr -table->record[0])] & return MY_TEST(record[(uint) (null_ptr - table->record[0])] & null_bit);
null_bit);
} }
inline void set_null(my_ptrdiff_t row_offset= 0) inline void set_null(my_ptrdiff_t row_offset= 0)
{ if (null_ptr) null_ptr[row_offset]|= null_bit; } { if (null_ptr) null_ptr[row_offset]|= null_bit; }
@ -1054,7 +1053,7 @@ public:
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *);
virtual bool str_needs_quotes() { return TRUE; } virtual bool str_needs_quotes() { return TRUE; }
uint is_equal(Create_field *new_field); 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; } virtual uint length_size() { return 0; }
double pos_in_interval(Field *min, Field *max) double pos_in_interval(Field *min, Field *max)
{ {
@ -1654,7 +1653,7 @@ public:
const char *field_name_arg, const char *field_name_arg,
TABLE_SHARE *share, uint dec_arg) : TABLE_SHARE *share, uint dec_arg) :
Field_timestamp(ptr_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), null_bit_arg, unireg_check_arg, field_name_arg, share),
dec(dec_arg) dec(dec_arg)
{ {
@ -1865,8 +1864,8 @@ public:
Field_time_with_dec(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, 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, enum utype unireg_check_arg, const char *field_name_arg,
uint dec_arg) uint dec_arg)
:Field_time(ptr_arg, MIN_TIME_WIDTH + dec_arg + test(dec_arg), null_ptr_arg, :Field_time(ptr_arg, MIN_TIME_WIDTH + dec_arg + MY_TEST(dec_arg),
null_bit_arg, unireg_check_arg, field_name_arg), null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg),
dec(dec_arg) dec(dec_arg)
{ {
DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS); DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS);
@ -2022,7 +2021,7 @@ public:
Field_datetime_with_dec(uchar *ptr_arg, uchar *null_ptr_arg, Field_datetime_with_dec(uchar *ptr_arg, uchar *null_ptr_arg,
uchar null_bit_arg, enum utype unireg_check_arg, uchar null_bit_arg, enum utype unireg_check_arg,
const char *field_name_arg, uint dec_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, null_ptr_arg, null_bit_arg, unireg_check_arg,
field_name_arg), dec(dec_arg) field_name_arg), dec(dec_arg)
{ {
@ -2649,9 +2648,9 @@ public:
{ {
DBUG_ASSERT(ptr == a || ptr == b); DBUG_ASSERT(ptr == a || ptr == b);
if (ptr == a) 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 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) int cmp_binary_offset(uint row_offset)
{ return cmp_offset(row_offset); } { return cmp_offset(row_offset); }

View File

@ -399,7 +399,7 @@ static void do_field_int(Copy_field *copy)
{ {
longlong value= copy->from_field->val_int(); longlong value= copy->from_field->val_int();
copy->to_field->store(value, 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) 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(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));
} }

View File

@ -3421,7 +3421,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
m_mode= mode; m_mode= mode;
m_open_test_lock= test_if_locked; m_open_test_lock= test_if_locked;
m_part_field_array= m_part_info->full_part_field_array; 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); DBUG_RETURN(error);
name_buffer_ptr= m_name_buffer_ptr; name_buffer_ptr= m_name_buffer_ptr;
if (populate_partition_name_hash()) 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_start_key.key= NULL;
m_index_scan_type= partition_read_range; 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); DBUG_RETURN(error);
} }
@ -7689,7 +7689,7 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array)
ulong nr1= 1; ulong nr1= 1;
ulong nr2= 4; ulong nr2= 4;
bool use_51_hash; bool use_51_hash;
use_51_hash= test((*field_array)->table->part_info->key_algorithm == use_51_hash= MY_TEST((*field_array)->table->part_info->key_algorithm ==
partition_info::KEY_ALGORITHM_51); partition_info::KEY_ALGORITHM_51);
do do

View File

@ -2469,7 +2469,7 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode,
cached_table_flags= table_flags(); cached_table_flags= table_flags();
} }
reset_statistics(); 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); DBUG_RETURN(error);
} }

View File

@ -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) 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) static inline bool ha_storage_engine_is_enabled(const handlerton *db_type)

View File

@ -852,7 +852,7 @@ void Item_ident::cleanup()
table_name= orig_table_name; table_name= orig_table_name;
field_name= orig_field_name; field_name= orig_field_name;
/* Store if this Item was depended */ /* Store if this Item was depended */
can_be_depended= test(depended_from); can_be_depended= MY_TEST(depended_from);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -2428,7 +2428,7 @@ void Item_field::set_field(Field *field_par)
field_name= field_par->field_name; field_name= field_par->field_name;
db_name= field_par->table->s->db.str; db_name= field_par->table->s->db.str;
alias_name_used= field_par->table->alias_name_used; 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(), collation.set(field_par->charset(), field_par->derivation(),
field_par->repertoire()); field_par->repertoire());
fix_char_length(field_par->char_length()); fix_char_length(field_par->char_length());

View File

@ -1462,7 +1462,7 @@ public:
{ {
if (is_expensive_cache < 0) if (is_expensive_cache < 0)
is_expensive_cache= walk(&Item::is_expensive_processor, 0, (uchar*)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 virtual Field::geometry_type get_geometry_type() const
{ return Field::GEOM_GEOMETRY; }; { return Field::GEOM_GEOMETRY; };
@ -2400,7 +2400,7 @@ public:
virtual void print(String *str, enum_query_type query_type); virtual void print(String *str, enum_query_type query_type);
Item_num *neg() { value= -value; return this; } Item_num *neg() { value= -value; return this; }
uint decimal_precision() const 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 eq(const Item *, bool binary_cmp) const;
bool check_partition_func_processor(uchar *bool_arg) { return FALSE;} bool check_partition_func_processor(uchar *bool_arg) { return FALSE;}
bool check_vcol_func_processor(uchar *arg) { return FALSE;} bool check_vcol_func_processor(uchar *arg) { return FALSE;}
@ -4225,7 +4225,7 @@ public:
virtual void store(Item *item); virtual void store(Item *item);
virtual bool cache_value()= 0; virtual bool cache_value()= 0;
bool basic_const_item() const 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; } virtual void clear() { null_value= TRUE; value_cached= FALSE; }
bool is_null() { return null_value; } bool is_null() { return null_value; }
virtual bool is_expensive() virtual bool is_expensive()

View File

@ -503,7 +503,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
if (0 == field_cmp) if (0 == field_cmp)
{ {
Item *tmp= new Item_int_with_ref(field->val_int(), *item, Item *tmp= new Item_int_with_ref(field->val_int(), *item,
test(field->flags & UNSIGNED_FLAG)); MY_TEST(field->flags & UNSIGNED_FLAG));
if (tmp) if (tmp)
thd->change_item_tree(item, tmp); thd->change_item_tree(item, tmp);
result= 1; // Item was replaced result= 1; // Item was replaced
@ -1044,8 +1044,8 @@ int Arg_comparator::compare_e_string()
res1= (*a)->val_str(&value1); res1= (*a)->val_str(&value1);
res2= (*b)->val_str(&value2); res2= (*b)->val_str(&value2);
if (!res1 || !res2) if (!res1 || !res2)
return test(res1 == res2); return MY_TEST(res1 == res2);
return test(sortcmp(res1, res2, cmp_collation.collation) == 0); 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); res1= (*a)->val_str(&value1);
res2= (*b)->val_str(&value2); res2= (*b)->val_str(&value2);
if (!res1 || !res2) if (!res1 || !res2)
return test(res1 == res2); return MY_TEST(res1 == res2);
return test(stringcmp(res1, res2) == 0); return MY_TEST(stringcmp(res1, res2) == 0);
} }
@ -1111,8 +1111,8 @@ int Arg_comparator::compare_e_real()
double val1= (*a)->val_real(); double val1= (*a)->val_real();
double val2= (*b)->val_real(); double val2= (*b)->val_real();
if ((*a)->null_value || (*b)->null_value) if ((*a)->null_value || (*b)->null_value)
return test((*a)->null_value && (*b)->null_value); return MY_TEST((*a)->null_value && (*b)->null_value);
return test(val1 == val2); return MY_TEST(val1 == val2);
} }
int Arg_comparator::compare_e_decimal() 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 *val1= (*a)->val_decimal(&decimal1);
my_decimal *val2= (*b)->val_decimal(&decimal2); my_decimal *val2= (*b)->val_decimal(&decimal2);
if ((*a)->null_value || (*b)->null_value) if ((*a)->null_value || (*b)->null_value)
return test((*a)->null_value && (*b)->null_value); return MY_TEST((*a)->null_value && (*b)->null_value);
return test(my_decimal_cmp(val1, val2) == 0); 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 val1= (*a)->val_real();
double val2= (*b)->val_real(); double val2= (*b)->val_real();
if ((*a)->null_value || (*b)->null_value) if ((*a)->null_value || (*b)->null_value)
return test((*a)->null_value && (*b)->null_value); return MY_TEST((*a)->null_value && (*b)->null_value);
return test(val1 == val2 || fabs(val1 - val2) < precision); 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 val1= (*a)->val_int();
longlong val2= (*b)->val_int(); longlong val2= (*b)->val_int();
if ((*a)->null_value || (*b)->null_value) if ((*a)->null_value || (*b)->null_value)
return test((*a)->null_value && (*b)->null_value); return MY_TEST((*a)->null_value && (*b)->null_value);
return test(val1 == val2); return MY_TEST(val1 == val2);
} }
/** /**
@ -1284,8 +1284,8 @@ int Arg_comparator::compare_e_int_diff_signedness()
longlong val1= (*a)->val_int(); longlong val1= (*a)->val_int();
longlong val2= (*b)->val_int(); longlong val2= (*b)->val_int();
if ((*a)->null_value || (*b)->null_value) if ((*a)->null_value || (*b)->null_value)
return test((*a)->null_value && (*b)->null_value); return MY_TEST((*a)->null_value && (*b)->null_value);
return (val1 >= 0) && test(val1 == val2); return (val1 >= 0) && MY_TEST(val1 == val2);
} }
int Arg_comparator::compare_row() int Arg_comparator::compare_row()

View File

@ -388,7 +388,7 @@ public:
Item_func::print_op(str, query_type); 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; } bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; } CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; }
uint decimal_precision() const { return 1; } uint decimal_precision() const { return 1; }
@ -874,7 +874,7 @@ public:
/* Compare values number pos1 and pos2 for equality */ /* Compare values number pos1 and pos2 for equality */
bool compare_elems(uint pos1, uint pos2) 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; virtual Item_result result_type()= 0;
}; };
@ -1838,7 +1838,7 @@ public:
bool contains(Field *field); bool contains(Field *field);
Item* get_first(struct st_join_table *context, Item *field); Item* get_first(struct st_join_table *context, Item *field);
/** Get number of field items / references to field items in this object */ /** 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); void merge(Item_equal *item);
bool merge_with_check(Item_equal *equal_item, bool save_merged); bool merge_with_check(Item_equal *equal_item, bool save_merged);
void merge_into_list(List<Item_equal> *list, bool save_merged, void merge_into_list(List<Item_equal> *list, bool save_merged,

View File

@ -2615,7 +2615,8 @@ void Item_func_round::fix_length_and_dec()
case INT_RESULT: case INT_RESULT:
if ((!decimals_to_set && truncate) || (args[0]->decimal_precision() < DECIMAL_LONGLONG_DIGITS)) 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; max_length= args[0]->max_length + length_can_increase;
/* Here we can keep INT_RESULT */ /* Here we can keep INT_RESULT */
cached_result_type= INT_RESULT; cached_result_type= INT_RESULT;
@ -4617,7 +4618,7 @@ longlong Item_func_sleep::val_int()
mysql_cond_destroy(&cond); 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; max_length= sp_result_field->field_length;
collation.set(sp_result_field->charset()); collation.set(sp_result_field->charset());
maybe_null= 1; 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; DBUG_VOID_RETURN;
} }

View File

@ -244,7 +244,7 @@ String *Item_func_centroid::val_str(String *str)
srid= uint4korr(swkb->ptr()); srid= uint4korr(swkb->ptr());
str->q_append(srid); str->q_append(srid);
return (null_value= test(geom->centroid(str))) ? 0 : str; return (null_value= MY_TEST(geom->centroid(str))) ? 0 : str;
} }

View File

@ -4784,7 +4784,7 @@ String *Item_dyncol_get::val_str(String *str_result)
goto null; goto null;
case DYN_COL_INT: case DYN_COL_INT:
case DYN_COL_UINT: 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); &my_charset_latin1);
break; break;
case DYN_COL_DOUBLE: case DYN_COL_DOUBLE:

View File

@ -3399,7 +3399,7 @@ bool subselect_union_engine::is_executed() const
bool subselect_union_engine::no_rows() bool subselect_union_engine::no_rows()
{ {
/* Check if we got any rows when reading UNION result from temp. table: */ /* 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,7 +5241,7 @@ int subselect_hash_sj_engine::exec()
/* The subquery should be optimized, and materialized only once. */ /* The subquery should be optimized, and materialized only once. */
DBUG_ASSERT(materialize_join->optimized && !is_materialized); DBUG_ASSERT(materialize_join->optimized && !is_materialized);
materialize_join->exec(); materialize_join->exec();
if ((res= test(materialize_join->error || thd->is_fatal_error || if ((res= MY_TEST(materialize_join->error || thd->is_fatal_error ||
thd->is_error()))) thd->is_error())))
goto err; goto err;
@ -5325,7 +5325,7 @@ int subselect_hash_sj_engine::exec()
count_pm_keys= count_partial_match_columns - count_null_only_columns + count_pm_keys= count_partial_match_columns - count_null_only_columns +
(nn_key_parts ? 1 : 0); (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, has_covering_null_row,
&partial_match_key_parts); &partial_match_key_parts);
DBUG_ASSERT(strategy == PARTIAL_MATCH_MERGE || 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. Do not add the non_null_key, since it was already processed above.
*/ */
bitmap_clear_all(&matching_outer_cols); 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); DBUG_ASSERT(merge_keys[i]->get_column_count() == 1);
if (merge_keys[i]->get_search_key(0)->null_value) 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 nullable columns (above we guarantee there is a match for the non-null
coumns), the result is UNKNOWN. 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; res= TRUE;
goto end; goto end;

View File

@ -566,7 +566,7 @@ public:
if ( pushed_cond_guards) if ( pushed_cond_guards)
pushed_cond_guards[i]= v; 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 Item_func_not_all *upper_item; // point on NOT/NOP before ALL/SOME subquery
@ -621,7 +621,7 @@ public:
int get_identifier(); int get_identifier();
bool test_strategy(uchar strategy) 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 Test that the IN strategy was chosen for execution. This is so
@ -641,7 +641,7 @@ public:
} }
bool is_set_strategy() bool is_set_strategy()
{ return test(in_strategy & SUBS_STRATEGY_CHOSEN); } { return MY_TEST(in_strategy & SUBS_STRATEGY_CHOSEN); }
bool has_strategy() bool has_strategy()
{ return in_strategy != SUBS_NOT_TRANSFORMED; } { return in_strategy != SUBS_NOT_TRANSFORMED; }

View File

@ -1077,7 +1077,7 @@ longlong Item_func_weekday::val_int()
return (longlong) calc_weekday(calc_daynr(ltime.year, ltime.month, return (longlong) calc_weekday(calc_daynr(ltime.year, ltime.month,
ltime.day), ltime.day),
odbc_type) + test(odbc_type); odbc_type) + MY_TEST(odbc_type);
} }
void Item_func_dayname::fix_length_and_dec() void Item_func_dayname::fix_length_and_dec()

View File

@ -126,7 +126,7 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
{ {
if (key_part->null_bit) if (key_part->null_bit)
{ {
*to_key++= test(from_record[key_part->null_offset] & *to_key++= MY_TEST(from_record[key_part->null_offset] &
key_part->null_bit); key_part->null_bit);
key_length--; key_length--;
if (to_key[-1]) if (to_key[-1])
@ -300,7 +300,7 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
if (key_part->null_bit) if (key_part->null_bit)
{ {
if (*key != test(table->record[0][key_part->null_offset] & if (*key != MY_TEST(table->record[0][key_part->null_offset] &
key_part->null_bit)) key_part->null_bit))
return 1; return 1;
if (*key) if (*key)
@ -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, 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_tmp_restore_column_map(table->read_set, old_map);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;

View File

@ -749,7 +749,7 @@ static void print_set_option(IO_CACHE* file, uint32 bits_changed,
{ {
if (*need_comma) if (*need_comma)
my_b_write(file, ", ", 2); 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; *need_comma= 1;
} }
} }
@ -1089,7 +1089,7 @@ my_bool Log_event::need_checksum()
(checksum_alg != BINLOG_CHECKSUM_ALG_OFF) : (checksum_alg != BINLOG_CHECKSUM_ALG_OFF) :
((binlog_checksum_options != BINLOG_CHECKSUM_ALG_OFF) && ((binlog_checksum_options != BINLOG_CHECKSUM_ALG_OFF) &&
(cache_type == Log_event::EVENT_NO_CACHE)) ? (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. FD calls the methods before data_written has been calculated.

View File

@ -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"); DBUG_ENTER("handler::multi_range_read_init");
mrr_iter= seq_funcs->init(seq_init_param, n_ranges, mode); mrr_iter= seq_funcs->init(seq_init_param, n_ranges, mode);
mrr_funcs= *seq_funcs; 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; mrr_have_range= FALSE;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -292,7 +292,7 @@ scan_it_again:
&mrr_cur_range.start_key : 0, &mrr_cur_range.start_key : 0,
mrr_cur_range.end_key.keypart_map ? mrr_cur_range.end_key.keypart_map ?
&mrr_cur_range.end_key : 0, &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); mrr_is_output_sorted);
if (result != HA_ERR_END_OF_FILE) if (result != HA_ERR_END_OF_FILE)
break; break;
@ -549,12 +549,12 @@ int Mrr_ordered_index_reader::init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
keypar= *key_par_arg; keypar= *key_par_arg;
KEY *key_info= &file->get_table()->key_info[file->active_index]; KEY *key_info= &file->get_table()->key_info[file->active_index];
keypar.index_ranges_unique= test(key_info->flags & HA_NOSAME && keypar.index_ranges_unique= MY_TEST(key_info->flags & HA_NOSAME &&
key_info->user_defined_key_parts == key_info->user_defined_key_parts ==
my_count_bits(keypar.key_tuple_map)); my_count_bits(keypar.key_tuple_map));
mrr_iter= seq_funcs->init(seq_init_param, n_ranges, mode); 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; mrr_funcs= *seq_funcs;
source_exhausted= FALSE; source_exhausted= FALSE;
if (support_scan_interruptions) if (support_scan_interruptions)
@ -578,7 +578,7 @@ int Mrr_ordered_rndpos_reader::init(handler *h_arg,
file= h_arg; file= h_arg;
index_reader= index_reader_arg; index_reader= index_reader_arg;
rowid_buffer= buf; 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_exhausted= FALSE;
index_reader_needs_refill= TRUE; index_reader_needs_refill= TRUE;
return 0; 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. has not been called, so set the owner handler here as well.
*/ */
primary_file= h_arg; 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; strategy_exhausted= FALSE;
@ -867,7 +867,7 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
if (do_sort_keys) if (do_sort_keys)
{ {
/* Pre-calculate some parameters of key sorting */ /* 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, seq_funcs->get_key_info(seq_init_param, &keypar.key_tuple_length,
&keypar.key_tuple_map); &keypar.key_tuple_map);
keypar.key_size_in_keybuf= keypar.use_key_pointers? 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) so small that it can accomodate one rowid and one index tuple)
*/ */
if ((res= primary_file->ha_rnd_end()) || 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); DBUG_RETURN(res);
} }
@ -1521,7 +1521,7 @@ bool key_uses_partial_cols(TABLE_SHARE *share, uint keyno)
bool DsMrr_impl::check_cpk_scan(THD *thd, TABLE_SHARE *share, uint keyno, bool DsMrr_impl::check_cpk_scan(THD *thd, TABLE_SHARE *share, uint keyno,
uint mrr_flags) uint mrr_flags)
{ {
return test((mrr_flags & HA_MRR_SINGLE_POINT) && return MY_TEST((mrr_flags & HA_MRR_SINGLE_POINT) &&
keyno == share->primary_key && keyno == share->primary_key &&
primary_file->primary_key_is_clustered() && primary_file->primary_key_is_clustered() &&
optimizer_flag(thd, OPTIMIZER_SWITCH_MRR_SORT_KEYS)); optimizer_flag(thd, OPTIMIZER_SWITCH_MRR_SORT_KEYS));
@ -1561,7 +1561,7 @@ bool DsMrr_impl::choose_mrr_impl(uint keyno, ha_rows rows, uint *flags,
TABLE_SHARE *share= primary_file->get_table_share(); TABLE_SHARE *share= primary_file->get_table_share();
bool doing_cpk_scan= check_cpk_scan(thd, share, keyno, *flags); bool doing_cpk_scan= check_cpk_scan(thd, share, keyno, *flags);
bool using_cpk= test(keyno == share->primary_key && bool using_cpk= MY_TEST(keyno == share->primary_key &&
primary_file->primary_key_is_clustered()); primary_file->primary_key_is_clustered());
*flags &= ~HA_MRR_IMPLEMENTATION_FLAGS; *flags &= ~HA_MRR_IMPLEMENTATION_FLAGS;
if (!optimizer_flag(thd, OPTIMIZER_SWITCH_MRR) || if (!optimizer_flag(thd, OPTIMIZER_SWITCH_MRR) ||
@ -1685,7 +1685,7 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags,
double index_read_cost; double index_read_cost;
elem_size= primary_file->ref_length + 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; max_buff_entries = *buffer_size / elem_size;
if (!max_buff_entries) if (!max_buff_entries)

View File

@ -62,7 +62,7 @@ public:
*/ */
inline bool have_apc_requests() inline bool have_apc_requests()
{ {
return test(apc_calls); return MY_TEST(apc_calls);
} }
inline bool is_enabled() { return enabled; } inline bool is_enabled() { return enabled; }

View File

@ -8359,7 +8359,7 @@ mysqld_get_one_option(int optid,
opt_myisam_log=1; opt_myisam_log=1;
break; break;
case (int) OPT_BIN_LOG: 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; opt_bin_log_used= 1;
break; break;
case (int) OPT_LOG_BASENAME: 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 Set some global variables from the global_system_variables
In most cases the global variables will not be used 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; my_default_record_cache_size=global_system_variables.read_buff_size;
/* /*
@ -8922,7 +8922,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
#endif #endif
global_system_variables.engine_condition_pushdown= global_system_variables.engine_condition_pushdown=
test(global_system_variables.optimizer_switch & MY_TEST(global_system_variables.optimizer_switch &
OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN); OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN);
opt_readonly= read_only; opt_readonly= read_only;

View File

@ -144,7 +144,7 @@ my_bool my_net_init(NET *net, Vio* vio, uint my_flags)
net->net_skip_rest_factor= 0; net->net_skip_rest_factor= 0;
net->last_errno=0; net->last_errno=0;
net->unused= 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 #ifdef MYSQL_SERVER
net->extension= NULL; net->extension= NULL;
#endif #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) if ((res= select((int) (sd + 1), &sfds, NULL, NULL, &tv)) < 0)
return 0; return 0;
else else
return test(res ? FD_ISSET(sd, &sfds) : 0); return MY_TEST(res ? FD_ISSET(sd, &sfds) : 0);
#endif /* HAVE_POLL */ #endif /* HAVE_POLL */
} }
@ -360,7 +360,7 @@ my_bool net_flush(NET *net)
DBUG_ENTER("net_flush"); DBUG_ENTER("net_flush");
if (net->buff != net->write_pos) if (net->buff != net->write_pos)
{ {
error=test(net_real_write(net, net->buff, error= MY_TEST(net_real_write(net, net->buff,
(size_t) (net->write_pos - net->buff))); (size_t) (net->write_pos - net->buff)));
net->write_pos= net->buff; net->write_pos= net->buff;
} }
@ -424,7 +424,7 @@ my_bool my_net_write(NET *net, const uchar *packet, size_t len)
#ifndef DEBUG_DATA_PACKETS #ifndef DEBUG_DATA_PACKETS
DBUG_DUMP("packet_header", buff, NET_HEADER_SIZE); DBUG_DUMP("packet_header", buff, NET_HEADER_SIZE);
#endif #endif
rc= test(net_write_buff(net,packet,len)); rc= MY_TEST(net_write_buff(net, packet, len));
MYSQL_NET_WRITE_DONE(rc); MYSQL_NET_WRITE_DONE(rc);
return rc; return rc;
} }
@ -498,7 +498,7 @@ net_write_command(NET *net,uchar command,
} }
int3store(buff,length); int3store(buff,length);
buff[3]= (uchar) net->pkt_nr++; buff[3]= (uchar) net->pkt_nr++;
rc= test(net_write_buff(net, buff, header_size) || rc= MY_TEST(net_write_buff(net, buff, header_size) ||
(head_len && net_write_buff(net, header, head_len)) || (head_len && net_write_buff(net, header, head_len)) ||
net_write_buff(net, packet, len) || net_flush(net)); net_write_buff(net, packet, len) || net_flush(net));
MYSQL_NET_WRITE_DONE(rc); MYSQL_NET_WRITE_DONE(rc);

View File

@ -205,7 +205,7 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
new_cond->argument_list()->push_back(fix); new_cond->argument_list()->push_back(fix);
used_tables|= fix->used_tables(); 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++; n_marked++;
item->marker= 0; item->marker= 0;
@ -238,7 +238,7 @@ Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
if (!fix) if (!fix)
return (COND*) 0; return (COND*) 0;
new_cond->argument_list()->push_back(fix); 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++; n_marked++;
item->marker= 0; item->marker= 0;

View File

@ -408,7 +408,7 @@ public:
new_max=arg->max_value; flag_max=arg->max_flag; new_max=arg->max_value; flag_max=arg->max_flag;
} }
return new SEL_ARG(field, part, new_min, new_max, flag_min, flag_max, 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) SEL_ARG *clone_first(SEL_ARG *arg)
{ // min <= X < arg->min { // 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 Assume that if the user is using 'limit' we will only need to scan
limit rows if we are using a key limit rows if we are using a key
*/ */
DBUG_RETURN(records ? test(quick) : -1); DBUG_RETURN(records ? MY_TEST(quick) : -1);
} }
/**************************************************************************** /****************************************************************************
@ -3782,7 +3782,7 @@ typedef struct st_part_prune_param
int last_subpart_partno; /* Same as above for supartitioning */ int last_subpart_partno; /* Same as above for supartitioning */
/* /*
is_part_keypart[i] == test(keypart #i in partitioning index is a member is_part_keypart[i] == MY_TEST(keypart #i in partitioning index is a member
used in partitioning) used in partitioning)
Used to maintain current values of cur_part_fields and cur_subpart_fields Used to maintain current values of cur_part_fields and cur_subpart_fields
*/ */
@ -3974,7 +3974,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
res == 1 => some used partitions => retval=FALSE res == 1 => some used partitions => retval=FALSE
res == -1 - we jump over this line to all_used: res == -1 - we jump over this line to all_used:
*/ */
retval= test(!res); retval= MY_TEST(!res);
goto end; goto end;
all_used: all_used:
@ -4607,7 +4607,7 @@ process_next_key_part:
ppar->mark_full_partition_used(ppar->part_info, part_id); ppar->mark_full_partition_used(ppar->part_info, part_id);
found= TRUE; found= TRUE;
} }
res= test(found); res= MY_TEST(found);
} }
/* /*
Restore the "used partitions iterator" to the default setting that 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 = if (!(common->search_scans =
(INDEX_SCAN_INFO **) alloc_root (param->mem_root, (INDEX_SCAN_INFO **) alloc_root (param->mem_root,
@ -5719,7 +5719,7 @@ bool prepare_search_best_index_intersect(PARAM *param,
if (!(common->best_intersect= if (!(common->best_intersect=
(INDEX_SCAN_INFO **) alloc_root (param->mem_root, (INDEX_SCAN_INFO **) alloc_root (param->mem_root,
sizeof(INDEX_SCAN_INFO *) * sizeof(INDEX_SCAN_INFO *) *
(i + test(cpk_scan != NULL))))) (i + MY_TEST(cpk_scan != NULL)))))
return TRUE; return TRUE;
size_t calc_cost_buff_size= 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; SEL_ARG *sel_arg, *tuple_arg= NULL;
key_part_map keypart_map= 0; key_part_map keypart_map= 0;
bool cur_covered; bool cur_covered;
bool prev_covered= test(bitmap_is_set(&info->covered_fields, bool prev_covered= MY_TEST(bitmap_is_set(&info->covered_fields,
key_part->fieldnr-1)); key_part->fieldnr - 1));
key_range min_range; key_range min_range;
key_range max_range; key_range max_range;
min_range.key= key_val; 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) sel_arg= sel_arg->next_key_part)
{ {
DBUG_PRINT("info",("sel_arg step")); DBUG_PRINT("info",("sel_arg step"));
cur_covered= test(bitmap_is_set(&info->covered_fields, cur_covered= MY_TEST(bitmap_is_set(&info->covered_fields,
key_part[sel_arg->part].fieldnr-1)); key_part[sel_arg->part].fieldnr - 1));
if (cur_covered != prev_covered) if (cur_covered != prev_covered)
{ {
/* create (part1val, ..., part{n-1}val) tuple. */ /* 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) if (param->table->key_info[param->real_keynr[idx]].flags & HA_SPATIAL)
quick=new QUICK_RANGE_SELECT_GEOM(param->thd, param->table, quick=new QUICK_RANGE_SELECT_GEOM(param->thd, param->table,
param->real_keynr[idx], param->real_keynr[idx],
test(parent_alloc), MY_TEST(parent_alloc),
parent_alloc, &create_err); parent_alloc, &create_err);
else else
quick=new QUICK_RANGE_SELECT(param->thd, param->table, quick=new QUICK_RANGE_SELECT(param->thd, param->table,
param->real_keynr[idx], param->real_keynr[idx],
test(parent_alloc), NULL, &create_err); MY_TEST(parent_alloc), NULL, &create_err);
if (quick) 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, result= file->read_range_first(last_range->min_keypart_map ? &start_key : 0,
last_range->max_keypart_map ? &end_key : 0, last_range->max_keypart_map ? &end_key : 0,
test(last_range->flag & EQ_RANGE), MY_TEST(last_range->flag & EQ_RANGE),
TRUE); TRUE);
if (last_range->flag == (UNIQUE_RANGE | EQ_RANGE)) if (last_range->flag == (UNIQUE_RANGE | EQ_RANGE))
last_range= 0; // Stop searching last_range= 0; // Stop searching

View File

@ -1004,7 +1004,7 @@ class SQL_SELECT :public Sql_alloc {
*/ */
inline int skip_record(THD *thd) 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()) if (thd->is_error())
rc= -1; rc= -1;
return rc; return rc;

View File

@ -1082,7 +1082,7 @@ bool convert_join_subqueries_to_semijoins(JOIN *join)
if (convert_join_subqueries_to_semijoins(child_join)) if (convert_join_subqueries_to_semijoins(child_join))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
in_subq->sj_convert_priority= 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; 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) if (!is_excluded_key)
{ {
keyinfo= table->key_info + 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) if (!is_excluded_key)
{ {
@ -2471,7 +2471,7 @@ 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 ((emb_sj_nest= prefix[i].table->emb_sj_nest))
{ {
if (inner_tables & emb_sj_nest->sj_inner_tables) if (inner_tables & emb_sj_nest->sj_inner_tables)
return !test(inner_tables == (emb_sj_nest->sj_inner_tables & return !MY_TEST(inner_tables == (emb_sj_nest->sj_inner_tables &
~join->const_table_map)); ~join->const_table_map));
} }
} }
@ -3206,7 +3206,7 @@ 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) if (join->positions[idx - i].table->emb_sj_nest != tab->emb_sj_nest)
return NULL; return NULL;
} }
*loose_scan= test(remaining_tables & ~tab->table->map & *loose_scan= MY_TEST(remaining_tables & ~tab->table->map &
(emb_sj_nest->sj_inner_tables | (emb_sj_nest->sj_inner_tables |
emb_sj_nest->nested_join->sj_depends_on)); emb_sj_nest->nested_join->sj_depends_on));
if (*loose_scan && !emb_sj_nest->sj_subq_pred->sjm_scan_allowed) if (*loose_scan && !emb_sj_nest->sj_subq_pred->sjm_scan_allowed)
@ -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++) 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); 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, *ref_key= new store_key_item(thd, cur_key_part->field,
/* TODO: /* TODO:
the NULL byte is taken into account in the NULL byte is taken into account in
cur_key_part->store_length, so instead of 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. use that information instead.
*/ */
cur_ref_buff + null_count, 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*)item)->functype()== Item_func::EQ_FUNC)
{ {
Item_func_eq *item_eq= (Item_func_eq*)item; 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; 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")); DBUG_PRINT("info",("Creating group key in temporary table"));
share->keys=1; share->keys=1;
share->uniques= test(using_unique_constraint); share->uniques= MY_TEST(using_unique_constraint);
table->key_info=keyinfo; table->key_info=keyinfo;
keyinfo->key_part=key_part_info; keyinfo->key_part=key_part_info;
keyinfo->flags=HA_NOSAME; keyinfo->flags=HA_NOSAME;

View File

@ -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, void check_ref_access_part1(JOIN_TAB *s, uint key, KEYUSE *start_key,
table_map found_part) table_map found_part)

View File

@ -295,7 +295,7 @@ int opt_sum_query(THD *thd,
if (!(tl->table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT) || if (!(tl->table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT) ||
tl->schema_table) tl->schema_table)
{ {
maybe_exact_count&= test(!tl->schema_table && maybe_exact_count&= MY_TEST(!tl->schema_table &&
(tl->table->file->ha_table_flags() & (tl->table->file->ha_table_flags() &
HA_HAS_RECORDS)); HA_HAS_RECORDS));
is_exact_count= FALSE; is_exact_count= FALSE;
@ -361,7 +361,7 @@ int opt_sum_query(THD *thd,
case Item_sum::MIN_FUNC: case Item_sum::MIN_FUNC:
case Item_sum::MAX_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 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 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); DBUG_RETURN(FALSE);
} }
if (!(cond->used_tables() & field->table->map) && 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 */ /* Condition doesn't restrict the used table */
DBUG_RETURN(!cond->const_item()); 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]; Item *value= args[between && max_fl ? 2 : 1];
value->save_in_field_no_warnings(part->field, 1); value->save_in_field_no_warnings(part->field, 1);
if (part->null_bit) 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); part->field->get_key_image(key_ptr, part->length, Field::itRAW);
} }
if (is_field_part) if (is_field_part)
@ -831,7 +831,7 @@ static bool matching_cond(bool max_fl, TABLE_REF *ref, KEY *keyinfo,
else if (eq_type) else if (eq_type)
{ {
if ((!is_null && !cond->val_int()) || 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 DBUG_RETURN(FALSE); // Impossible test
} }
else if (is_field_part) else if (is_field_part)

View File

@ -356,7 +356,7 @@ public:
bound. bound.
*/ */
void touch() { unbound_args--; } void touch() { unbound_args--; }
bool is_applicable() { return !test(unbound_args); } bool is_applicable() { return !MY_TEST(unbound_args); }
/* Iteration over values that */ /* Iteration over values that */
typedef char *Iterator; typedef char *Iterator;
@ -1072,7 +1072,7 @@ bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module>
else else
{ {
/* It's a multi-equality */ /* 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); List_iterator<Dep_value_field> it(*eq_mod->mult_equal_fields);
Dep_value_field* field_val; Dep_value_field* field_val;
while ((field_val= it++)) 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->mult_equal_fields= fv;
old->level= and_level; old->level= and_level;

View File

@ -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 */ /* now buf supposedly contains hash_stage1: so we can get hash_stage2 */
compute_sha1_hash(hash_stage2_reassured, (const char *) buf, SHA1_HASH_SIZE); 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));
} }
/* /*

View File

@ -547,7 +547,7 @@ file '%s')", fname);
mi->rli.is_relay_log_recovery= FALSE; mi->rli.is_relay_log_recovery= FALSE;
// now change cache READ -> WRITE - must do this before flush_master_info // now change cache READ -> WRITE - must do this before flush_master_info
reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1); 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"); sql_print_error("Failed to flush master info file");
mysql_mutex_unlock(&mi->data_lock); mysql_mutex_unlock(&mi->data_lock);
DBUG_RETURN(error); DBUG_RETURN(error);

View File

@ -668,7 +668,7 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list)
if ((error= var->check(thd))) if ((error= var->check(thd)))
goto err; goto err;
} }
if (!(error= test(thd->is_error()))) if (!(error= MY_TEST(thd->is_error())))
{ {
it.rewind(); it.rewind();
while ((var= it++)) while ((var= it++))

View File

@ -1049,8 +1049,8 @@ static bool sql_slave_killed(rpl_group_info *rgi)
DBUG_PRINT("info", ("modified_non_trans_table: %d OPTION_BEGIN: %d " DBUG_PRINT("info", ("modified_non_trans_table: %d OPTION_BEGIN: %d "
"OPTION_KEEP_LOG: %d is_in_group: %d", "OPTION_KEEP_LOG: %d is_in_group: %d",
thd->transaction.all.modified_non_trans_table, thd->transaction.all.modified_non_trans_table,
test(thd->variables.option_bits & OPTION_BEGIN), MY_TEST(thd->variables.option_bits & OPTION_BEGIN),
test(thd->variables.option_bits & OPTION_KEEP_LOG), MY_TEST(thd->variables.option_bits & OPTION_KEEP_LOG),
rli->is_in_group())); rli->is_in_group()));
if (rli->abort_slave) 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" "skipped because event skip counter was non-zero"
}; };
DBUG_PRINT("info", ("OPTION_BEGIN: %d IN_STMT: %d IN_TRANSACTION: %d", 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_STMT),
rli->get_flag(Relay_log_info::IN_TRANSACTION))); rli->get_flag(Relay_log_info::IN_TRANSACTION)));
DBUG_PRINT("skip_event", ("%s event was %s", DBUG_PRINT("skip_event", ("%s event was %s",

View File

@ -462,9 +462,10 @@ public:
else if (m_flags & HAS_SQLCOM_FLUSH) else if (m_flags & HAS_SQLCOM_FLUSH)
my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "FLUSH"); my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "FLUSH");
return test(m_flags & return MY_TEST(m_flags &
(CONTAINS_DYNAMIC_SQL|MULTI_RESULTS|HAS_SET_AUTOCOMMIT_STMT| (CONTAINS_DYNAMIC_SQL | MULTI_RESULTS |
HAS_COMMIT_OR_ROLLBACK|HAS_SQLCOM_RESET|HAS_SQLCOM_FLUSH)); HAS_SET_AUTOCOMMIT_STMT | HAS_COMMIT_OR_ROLLBACK |
HAS_SQLCOM_RESET | HAS_SQLCOM_FLUSH));
} }
#ifndef DBUG_OFF #ifndef DBUG_OFF

View File

@ -450,7 +450,7 @@ public:
int close(THD *thd); int close(THD *thd);
my_bool is_open() my_bool is_open()
{ return test(server_side_cursor); } { return MY_TEST(server_side_cursor); }
int fetch(THD *, List<sp_variable> *vars); int fetch(THD *, List<sp_variable> *vars);

View File

@ -2969,9 +2969,9 @@ static bool update_user_table(THD *thd, TABLE *table,
static bool test_if_create_new_users(THD *thd) static bool test_if_create_new_users(THD *thd)
{ {
Security_context *sctx= thd->security_ctx; 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 && (!opt_safe_user_create &&
test(sctx->master_access & CREATE_USER_ACL)); MY_TEST(sctx->master_access & CREATE_USER_ACL));
if (!create_new_users) if (!create_new_users)
{ {
TABLE_LIST tl; 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). now those roles were dropped or had their privileges revoked).
we need to remove this GRANT_TABLE 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); my_hash_delete(&column_priv_hash,(uchar*) merged);
return 4; 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) const char *db, const char *tname, role_hash_t *rhash)
{ {
Dynamic_array<GRANT_TABLE *> grants; 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 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; 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++;); DBUG_EXECUTE_IF("role_merge_stats", role_routine_merges++;);
@ -5530,7 +5531,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
else else
error=replace_user_table(thd, tables[0].table, *Str, error=replace_user_table(thd, tables[0].table, *Str,
0, revoke_grant, create_new_users, 0, revoke_grant, create_new_users,
test(thd->variables.sql_mode & MY_TEST(thd->variables.sql_mode &
MODE_NO_AUTO_CREATE_USER)); MODE_NO_AUTO_CREATE_USER));
if (error) if (error)
{ {
@ -5738,7 +5739,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
/* Create user if needed */ /* Create user if needed */
error=replace_user_table(thd, tables[0].table, *Str, error=replace_user_table(thd, tables[0].table, *Str,
0, revoke_grant, create_new_users, 0, revoke_grant, create_new_users,
test(thd->variables.sql_mode & MY_TEST(thd->variables.sql_mode &
MODE_NO_AUTO_CREATE_USER)); MODE_NO_AUTO_CREATE_USER));
if (error) if (error)
{ {
@ -5885,7 +5886,8 @@ bool mysql_grant_role(THD *thd, List <LEX_USER> &list, bool revoke)
rolename= granted_role->user; rolename= granted_role->user;
create_new_user= test_if_create_new_users(thd); 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]; TABLE_LIST tables[2];
tables[0].init_one_table(C_STRING_WITH_LEN("mysql"), tables[0].init_one_table(C_STRING_WITH_LEN("mysql"),
@ -6203,7 +6205,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
else else
if (replace_user_table(thd, tables[0].table, *Str, if (replace_user_table(thd, tables[0].table, *Str,
(!db ? rights : 0), revoke_grant, create_new_users, (!db ? rights : 0), revoke_grant, create_new_users,
test(thd->variables.sql_mode & MY_TEST(thd->variables.sql_mode &
MODE_NO_AUTO_CREATE_USER))) MODE_NO_AUTO_CREATE_USER)))
result= -1; result= -1;
else if (db) 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) 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= const ACL_internal_table_access *access=
get_cached_table_access(&tl->grant.m_internal, 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; GRANT_INFO *grant;
const char *db_name; const char *db_name;
const char *table_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; table_ref->security_ctx : thd->security_ctx;
if (table_ref->view || table_ref->field_translation) 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; db + passwd_len + 1 : 0;
if (passwd == NULL || 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; return packet_error;
/* strlen() can't be easily deleted without changing protocol */ /* strlen() can't be easily deleted without changing protocol */

View File

@ -1218,7 +1218,7 @@ bool Sql_cmd_repair_table::execute(THD *thd)
thd->enable_slow_log= opt_log_slow_admin_statements; thd->enable_slow_log= opt_log_slow_admin_statements;
res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "repair", res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "repair",
TL_WRITE, 1, 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, HA_OPEN_FOR_REPAIR, &prepare_for_repair,
&handler::ha_repair, 0); &handler::ha_repair, 0);

View File

@ -1142,7 +1142,8 @@ bool close_temporary_tables(THD *thd)
/* We always quote db,table names though it is slight overkill */ /* We always quote db,table names though it is slight overkill */
if (found_user_tables && 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; 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->lex->allow_sum_func= save_allow_sum_func;
thd->mark_used_columns= save_mark_used_columns; thd->mark_used_columns= save_mark_used_columns;
DBUG_PRINT("info", ("thd->mark_used_columns: %d", thd->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; select_lex->where= *conds;
} }
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; 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: err_no_arena:
select_lex->is_item_list_lookup= save_is_item_list_lookup; select_lex->is_item_list_lookup= save_is_item_list_lookup;

View File

@ -61,7 +61,7 @@ public:
intersect(map2buff); intersect(map2buff);
if (map.n_bits > sizeof(ulonglong) * 8) if (map.n_bits > sizeof(ulonglong) * 8)
bitmap_set_above(&map, sizeof(ulonglong), 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 subtract(Bitmap& map2) { bitmap_subtract(&map, &map2.map); }
void merge(Bitmap& map2) { bitmap_union(&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 intersect_extended(ulonglong map2) { map&= map2; }
void subtract(Bitmap<64>& map2) { map&= ~map2.map; } void subtract(Bitmap<64>& map2) { map&= ~map2.map; }
void merge(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_prefix(uint n) const { return map == (((ulonglong)1) << n)-1; }
bool is_clear_all() const { return map == (ulonglong)0; } bool is_clear_all() const { return map == (ulonglong)0; }
bool is_set_all() const { return map == ~(ulonglong)0; } bool is_set_all() const { return map == ~(ulonglong)0; }

View File

@ -1404,8 +1404,8 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
Query_cache_query_flags flags; Query_cache_query_flags flags;
// fill all gaps between fields with 0 to get repeatable key // fill all gaps between fields with 0 to get repeatable key
bzero(&flags, QUERY_CACHE_FLAGS_SIZE); bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
flags.client_long_flag= test(thd->client_capabilities & CLIENT_LONG_FLAG); flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG);
flags.client_protocol_41= test(thd->client_capabilities & flags.client_protocol_41= MY_TEST(thd->client_capabilities &
CLIENT_PROTOCOL_41); CLIENT_PROTOCOL_41);
/* /*
Protocol influences result format, so statement results in the binary Protocol influences result format, so statement results in the binary
@ -1415,10 +1415,10 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags.protocol_type= (unsigned int) thd->protocol->type(); flags.protocol_type= (unsigned int) thd->protocol->type();
/* PROTOCOL_LOCAL results are not cached. */ /* PROTOCOL_LOCAL results are not cached. */
DBUG_ASSERT(flags.protocol_type != (unsigned int) Protocol::PROTOCOL_LOCAL); DBUG_ASSERT(flags.protocol_type != (unsigned int) Protocol::PROTOCOL_LOCAL);
flags.more_results_exists= test(thd->server_status & flags.more_results_exists= MY_TEST(thd->server_status &
SERVER_MORE_RESULTS_EXISTS); SERVER_MORE_RESULTS_EXISTS);
flags.in_trans= thd->in_active_multi_stmt_transaction(); 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.pkt_nr= net->pkt_nr;
flags.character_set_client_num= flags.character_set_client_num=
thd->variables.character_set_client->number; 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 // fill all gaps between fields with 0 to get repeatable key
bzero(&flags, QUERY_CACHE_FLAGS_SIZE); bzero(&flags, QUERY_CACHE_FLAGS_SIZE);
flags.client_long_flag= test(thd->client_capabilities & CLIENT_LONG_FLAG); flags.client_long_flag= MY_TEST(thd->client_capabilities & CLIENT_LONG_FLAG);
flags.client_protocol_41= test(thd->client_capabilities & flags.client_protocol_41= MY_TEST(thd->client_capabilities &
CLIENT_PROTOCOL_41); CLIENT_PROTOCOL_41);
flags.protocol_type= (unsigned int) thd->protocol->type(); flags.protocol_type= (unsigned int) thd->protocol->type();
flags.more_results_exists= test(thd->server_status & flags.more_results_exists= MY_TEST(thd->server_status &
SERVER_MORE_RESULTS_EXISTS); SERVER_MORE_RESULTS_EXISTS);
flags.in_trans= thd->in_active_multi_stmt_transaction(); 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.pkt_nr= thd->net.pkt_nr;
flags.character_set_client_num= thd->variables.character_set_client->number; flags.character_set_client_num= thd->variables.character_set_client->number;
flags.character_set_results_num= flags.character_set_results_num=
@ -3409,7 +3409,7 @@ my_bool Query_cache::register_all_tables(THD *thd,
if (block_table->parent) if (block_table->parent)
unlink_table(block_table); 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) OPTION_TO_QUERY_CACHE,
(long) lex->select_lex.options, (long) lex->select_lex.options,
(int) thd->variables.query_cache_type, (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); DBUG_RETURN(0);
} }

View File

@ -515,14 +515,14 @@ extern "C" int mysql_tmpfile(const char *prefix)
extern "C" extern "C"
int thd_in_lock_tables(const THD *thd) int thd_in_lock_tables(const THD *thd)
{ {
return test(thd->in_lock_tables); return MY_TEST(thd->in_lock_tables);
} }
extern "C" extern "C"
int thd_tablespace_op(const THD *thd) int thd_tablespace_op(const THD *thd)
{ {
return test(thd->tablespace_op); return MY_TEST(thd->tablespace_op);
} }
extern "C" extern "C"
@ -2605,7 +2605,7 @@ void select_to_file::send_error(uint errcode,const char *err)
bool select_to_file::send_eof() 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()) if (mysql_file_close(file, MYF(MY_WME)) || thd->is_error())
error= true; error= true;
@ -2786,8 +2786,8 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
escape_char= (int) (uchar) (*exchange->escaped)[0]; escape_char= (int) (uchar) (*exchange->escaped)[0];
else else
escape_char= -1; escape_char= -1;
is_ambiguous_field_sep= test(strchr(ESCAPE_CHARS, field_sep_char)); is_ambiguous_field_sep= MY_TEST(strchr(ESCAPE_CHARS, field_sep_char));
is_unsafe_field_sep= test(strchr(NUMERIC_CHARS, field_sep_char)); is_unsafe_field_sep= MY_TEST(strchr(NUMERIC_CHARS, field_sep_char));
line_sep_char= (exchange->line_term->length() ? line_sep_char= (exchange->line_term->length() ?
(int) (uchar) (*exchange->line_term)[0] : INT_MAX); (int) (uchar) (*exchange->line_term)[0] : INT_MAX);
if (!field_term_length) if (!field_term_length)

View File

@ -4448,7 +4448,7 @@ public:
table.str= internal_table_name; table.str= internal_table_name;
table.length=1; 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) inline void change_db(char *db_name)
{ {
db.str= db_name; db.length= (uint) strlen(db_name); db.str= db_name; db.length= (uint) strlen(db_name);

View File

@ -140,7 +140,7 @@ void Update_plan::save_explain_data_intern(Explain_query *query,
explain->jtype= JT_NEXT; 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_filesort= using_filesort;
explain->using_io_buffer= using_io_buffer; 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; table->map=1;
query_plan.select_lex= &thd->lex->select_lex; query_plan.select_lex= &thd->lex->select_lex;
query_plan.table= table; 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, if (mysql_prepare_delete(thd, table_list, select_lex->with_wild,
select_lex->item_list, &conds)) select_lex->item_list, &conds))
@ -291,7 +291,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
const_cond= (!conds || conds->const_item()); 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) if (safe_update && const_cond)
{ {
my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,

View File

@ -660,7 +660,7 @@ static void save_insert_query_plan(THD* thd, TABLE_LIST *table_list)
thd->lex->explain->add_insert_plan(explain); thd->lex->explain->add_insert_plan(explain);
/* See Update_plan::updating_a_view for details */ /* See Update_plan::updating_a_view for details */
bool skip= test(table_list->view); bool skip= MY_TEST(table_list->view);
/* Save subquery children */ /* Save subquery children */
for (SELECT_LEX_UNIT *unit= thd->lex->select_lex.first_inner_unit(); 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) if (table_list)
{ {
table_list= table_list->top_table(); table_list= table_list->top_table();
view= test(table_list->view); view= MY_TEST(table_list->view);
} }
if (view) if (view)
{ {
@ -4211,7 +4211,7 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
result= store_create_info(thd, &tmp_table_list, &query, create_info, result= store_create_info(thd, &tmp_table_list, &query, create_info,
/* show_database */ TRUE, /* show_database */ TRUE,
test(create_info->options & MY_TEST(create_info->options &
HA_LEX_CREATE_REPLACE)); HA_LEX_CREATE_REPLACE));
DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */ DBUG_ASSERT(result == 0); /* store_create_info() always return 0 */

View File

@ -222,8 +222,8 @@ void JOIN_CACHE::calc_record_fields()
for (; tab != join_tab ; tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS)) for (; tab != join_tab ; tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS))
{ {
tab->calc_used_field_length(FALSE); tab->calc_used_field_length(FALSE);
flag_fields+= test(tab->used_null_fields || tab->used_uneven_bit_fields); flag_fields+= MY_TEST(tab->used_null_fields || tab->used_uneven_bit_fields);
flag_fields+= test(tab->table->maybe_null); flag_fields+= MY_TEST(tab->table->maybe_null);
fields+= tab->used_fields; fields+= tab->used_fields;
blobs+= tab->used_blobs; blobs+= tab->used_blobs;
} }
@ -736,7 +736,7 @@ void JOIN_CACHE::set_constants()
uint JOIN_CACHE::get_record_max_affix_length() uint JOIN_CACHE::get_record_max_affix_length()
{ {
uint len= get_prefix_length() + uint len= get_prefix_length() +
test(with_match_flag) + MY_TEST(with_match_flag) +
size_of_fld_ofs * data_field_count; size_of_fld_ofs * data_field_count;
return len; return len;
} }
@ -1012,7 +1012,7 @@ int JOIN_CACHE::realloc_buffer()
{ {
int rc; int rc;
free(); 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); reset(TRUE);
return rc; return rc;
} }
@ -1766,7 +1766,7 @@ uint JOIN_CACHE::read_flag_fields()
CACHE_FIELD *copy_end= copy+flag_fields; CACHE_FIELD *copy_end= copy+flag_fields;
if (with_match_flag) 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; pos+= copy->length;
copy++; copy++;
} }
@ -2520,7 +2520,7 @@ enum_nested_loop_state JOIN_CACHE::join_null_complements(bool skip_last)
if (!records) if (!records)
DBUG_RETURN(NESTED_LOOP_OK); 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 */ /* This function may be called only for inner tables of outer joins */
DBUG_ASSERT(join_tab->first_inner); DBUG_ASSERT(join_tab->first_inner);
@ -2570,7 +2570,7 @@ finish:
void JOIN_CACHE::save_explain_data(struct st_explain_bka_type *explain) 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()) { switch (get_join_alg()) {
case BNL_JOIN_ALG: case BNL_JOIN_ALG:
@ -2792,7 +2792,7 @@ int JOIN_CACHE_HASHED::realloc_buffer()
{ {
int rc; int rc;
free(); 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(); init_hash_table();
reset(TRUE); reset(TRUE);
return rc; return rc;
@ -3472,7 +3472,7 @@ bool JOIN_CACHE_BNL::prepare_look_for_matches(bool skip_last)
if (!records) if (!records)
return TRUE; return TRUE;
reset(FALSE); reset(FALSE);
rem_records= records-test(skip_last); rem_records= records - MY_TEST(skip_last);
return rem_records == 0; return rem_records == 0;
} }
@ -4588,7 +4588,7 @@ int JOIN_CACHE_BKAH::init()
{ {
bool check_only_first_match= join_tab->check_only_first_match(); 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, RANGE_SEQ_IF rs_funcs= { bka_range_seq_key_info,
bkah_range_seq_init, bkah_range_seq_init,

View File

@ -299,7 +299,7 @@ Lex_input_stream::reset(char *buffer, unsigned int length)
m_cpp_utf8_processed_ptr= NULL; m_cpp_utf8_processed_ptr= NULL;
next_state= MY_LEX_START; next_state= MY_LEX_START;
found_semicolon= NULL; 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; stmt_prepare_mode= FALSE;
multi_statements= TRUE; multi_statements= TRUE;
in_comment=NO_COMMENT; 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 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.table_list=
select_lex.context.first_name_resolution_table= first->next_local; select_lex.context.first_name_resolution_table= first->next_local;
@ -3824,7 +3824,7 @@ void SELECT_LEX::update_used_tables()
do do
{ {
bool maybe_null; bool maybe_null;
if ((maybe_null= test(embedding->outer_join))) if ((maybe_null= MY_TEST(embedding->outer_join)))
{ {
tl->table->maybe_null= maybe_null; tl->table->maybe_null= maybe_null;
break; break;
@ -3901,37 +3901,40 @@ void st_select_lex::update_correlated_cache()
while ((tl= ti++)) while ((tl= ti++))
{ {
if (tl->on_expr) 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 ; for (TABLE_LIST *embedding= tl->embedding ; embedding ;
embedding= embedding->embedding) embedding= embedding->embedding)
{ {
if (embedding->on_expr) if (embedding->on_expr)
is_correlated|= test(embedding->on_expr->used_tables() & is_correlated|= MY_TEST(embedding->on_expr->used_tables() &
OUTER_REF_TABLE_BIT); OUTER_REF_TABLE_BIT);
} }
} }
if (join->conds) 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) 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) 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; Item *item;
List_iterator_fast<Item> it(join->fields_list); List_iterator_fast<Item> it(join->fields_list);
while ((item= it++)) 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) 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()) if (!master_unit()->is_union())
{ {
for (ORDER *order= order_list.first; order; order= order->next) 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) 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->add_select(sl->select_number);
eu->fake_select_type= "UNION RESULT"; 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 // Save the UNION node
output->add_node(eu); output->add_node(eu);

View File

@ -1152,7 +1152,7 @@ public:
} }
bool requires_prelocking() 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) void mark_as_requiring_prelocking(TABLE_LIST **tables_own_last)
{ {

View File

@ -462,7 +462,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
} }
thd_proc_info(thd, "reading file"); 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; table->next_number_field=table->found_next_number_field;
if (ignore || 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(); thd->get_stmt_da()->inc_current_row_for_warning();
continue_loop:; 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(); thd->get_stmt_da()->inc_current_row_for_warning();
continue_loop:; 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(); thd->get_stmt_da()->inc_current_row_for_warning();
continue_loop:; continue_loop:;
} }
DBUG_RETURN(test(read_info.error) || thd->is_error()); DBUG_RETURN(MY_TEST(read_info.error) || thd->is_error());
} /* load xml end */ } /* load xml end */

View File

@ -2416,7 +2416,7 @@ mysql_execute_command(THD *thd)
#endif #endif
status_var_increment(thd->status_var.com_stat[lex->sql_command]); status_var_increment(thd->status_var.com_stat[lex->sql_command]);
thd->progress.report_to_client= test(sql_command_flags[lex->sql_command] & thd->progress.report_to_client= MY_TEST(sql_command_flags[lex->sql_command] &
CF_REPORT_PROGRESS); CF_REPORT_PROGRESS);
DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == FALSE); DBUG_ASSERT(thd->transaction.stmt.modified_non_trans_table == FALSE);
@ -3500,7 +3500,7 @@ end_with_restore_list:
case SQLCOM_INSERT_SELECT: case SQLCOM_INSERT_SELECT:
{ {
select_result *sel_result; select_result *sel_result;
bool explain= test(lex->describe); bool explain= MY_TEST(lex->describe);
DBUG_ASSERT(first_table == all_tables && first_table != 0); DBUG_ASSERT(first_table == all_tables && first_table != 0);
if ((res= insert_precheck(thd, all_tables))) if ((res= insert_precheck(thd, all_tables)))
break; break;
@ -3614,7 +3614,7 @@ end_with_restore_list:
{ {
DBUG_ASSERT(first_table == all_tables && first_table != 0); DBUG_ASSERT(first_table == all_tables && first_table != 0);
TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first; TABLE_LIST *aux_tables= thd->lex->auxiliary_table_list.first;
bool explain= test(lex->describe); bool explain= MY_TEST(lex->describe);
multi_delete *result; multi_delete *result;
if ((res= multi_delete_precheck(thd, all_tables))) 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) if (!table)
DBUG_RETURN(0); // End of memory DBUG_RETURN(0); // End of memory
alias_str= alias ? alias->str : table->table.str; 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)) check_table_name(table->table.str, table->table.length, FALSE))
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str); 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=table->table.str;
ptr->table_name_length=table->table.length; ptr->table_name_length=table->table.length;
ptr->lock_type= lock_type; 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 */ /* 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->force_index= MY_TEST(table_options & TL_OPTION_FORCE_INDEX);
ptr->ignore_leaves= test(table_options & TL_OPTION_IGNORE_LEAVES); ptr->ignore_leaves= MY_TEST(table_options & TL_OPTION_IGNORE_LEAVES);
ptr->derived= table->sel; ptr->derived= table->sel;
if (!ptr->derived && is_infoschema_db(ptr->db, ptr->db_length)) 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); lex->add_to_query_tables(ptr);
// Pure table aliases do not need to be locked: // 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, ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type,
MDL_TRANSACTION); MDL_TRANSACTION);

View File

@ -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) inline bool is_supported_parser_charset(CHARSET_INFO *cs)
{ {
return test(cs->mbminlen == 1); return MY_TEST(cs->mbminlen == 1);
} }

View File

@ -3308,7 +3308,7 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
} }
else 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); } while (max_list_index >= min_list_index);
notfound: notfound:
@ -5783,7 +5783,7 @@ static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
if (mysql_trans_commit_alter_copy_data(thd)) if (mysql_trans_commit_alter_copy_data(thd))
error= 1; /* The error has been reported */ 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. index-in-ordered-array-of-list-constants (for LIST) space.
*/ */
store_key_image_to_rec(field, min_value, field_len); 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); part_iter->part_nums.start= get_endpoint(part_info, 1, include_endp);
if (!can_match_multiple_values && part_info->part_expr->null_value) 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 else
{ {
store_key_image_to_rec(field, max_value, field_len); 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); part_iter->part_nums.end= get_endpoint(part_info, 0, include_endp);
if (check_zero_dates && if (check_zero_dates &&
!zero_in_start_date && !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) if ((ulonglong)b - (ulonglong)a == ~0ULL)
DBUG_RETURN(-1); DBUG_RETURN(-1);
a += test(flags & NEAR_MIN); a+= MY_TEST(flags & NEAR_MIN);
b += test(!(flags & NEAR_MAX)); b+= MY_TEST(!(flags & NEAR_MAX));
ulonglong n_values= b - a; ulonglong n_values= b - a;
/* /*

View File

@ -978,7 +978,7 @@ static bool setup_conversion_functions(Prepared_statement *stmt,
typecode= sint2korr(read_pos); typecode= sint2korr(read_pos);
read_pos+= 2; 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)); 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("exec_query", ("%s", stmt->query()));
DBUG_PRINT("info",("stmt: 0x%lx", (long) stmt)); 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; thd->protocol= &thd->protocol_binary;
stmt->execute_loop(&expanded_query, open_cursor, packet, packet_end); stmt->execute_loop(&expanded_query, open_cursor, packet, packet_end);

View File

@ -290,7 +290,7 @@ public:
one. one.
Never fails. 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. Only valid to call if has_next_result() returned true.
Otherwise the result is undefined. Otherwise the result is undefined.
@ -298,7 +298,7 @@ public:
bool move_to_next_result() bool move_to_next_result()
{ {
m_current_rset= m_current_rset->m_next_rset; 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(); } ~Ed_connection() { free_old_result(); }

View File

@ -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 */ /* Perform FULLTEXT search before all regular searches */
if (!(select_options & SELECT_DESCRIBE)) if (!(select_options & SELECT_DESCRIBE))
init_ftfuncs(thd, select_lex, test(order)); init_ftfuncs(thd, select_lex, MY_TEST(order));
if (optimize_unflattened_subqueries()) if (optimize_unflattened_subqueries())
DBUG_RETURN(1); DBUG_RETURN(1);
@ -2279,7 +2279,7 @@ JOIN::reinit()
} }
if (!(select_options & SELECT_DESCRIBE)) if (!(select_options & SELECT_DESCRIBE))
init_ftfuncs(thd, select_lex, test(order)); init_ftfuncs(thd, select_lex, MY_TEST(order));
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -2602,7 +2602,7 @@ void JOIN::exec_inner()
curr_join->const_tables != curr_join->table_count) curr_join->const_tables != curr_join->table_count)
{ {
JOIN_TAB *first_tab= curr_join->join_tab + curr_join->const_tables; 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; Procedure *save_proc= curr_join->procedure;
@ -2782,7 +2782,7 @@ void JOIN::exec_inner()
curr_join->const_tables != curr_join->table_count) curr_join->const_tables != curr_join->table_count)
{ {
JOIN_TAB *first_tab= curr_join->join_tab + curr_join->const_tables; 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; tmp_error= -1;
if (setup_sum_funcs(curr_join->thd, curr_join->sum_funcs) || 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) if (a->keypart != b->keypart)
return (int) (a->keypart - b->keypart); return (int) (a->keypart - b->keypart);
// Place const values before other ones // Place const values before other ones
if ((res= test((a->used_tables & ~OUTER_REF_TABLE_BIT)) - if ((res= MY_TEST((a->used_tables & ~OUTER_REF_TABLE_BIT)) -
test((b->used_tables & ~OUTER_REF_TABLE_BIT)))) MY_TEST((b->used_tables & ~OUTER_REF_TABLE_BIT))))
return res; return res;
/* Place rows that are not 'OPTIMIZE_REF_OR_NULL' first */ /* Place rows that are not 'OPTIMIZE_REF_OR_NULL' first */
return (int) ((a->optimize & KEY_OPTIMIZE_REF_OR_NULL) - return (int) ((a->optimize & KEY_OPTIMIZE_REF_OR_NULL) -
@ -5766,7 +5766,7 @@ best_access_path(JOIN *join,
} }
else 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); loose_scan_opt.check_ref_access_part1(s, key, start_key, found_part);
/* Check if we found full key */ /* Check if we found full key */
@ -5775,7 +5775,7 @@ best_access_path(JOIN *join,
{ /* use eq key */ { /* use eq key */
max_key_part= (uint) ~0; max_key_part= (uint) ~0;
if ((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME || 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); tmp = prev_record_reads(join->positions, idx, found_ref);
records=1.0; records=1.0;
@ -5906,7 +5906,7 @@ best_access_path(JOIN *join,
*/ */
if (table->quick_keys.is_set(key) && !found_ref && //(C1) if (table->quick_keys.is_set(key) && !found_ref && //(C1)
table->quick_key_parts[key] == max_key_part && //(C2) 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]; tmp= records= (double) table->quick_rows[key];
} }
@ -6000,7 +6000,7 @@ best_access_path(JOIN *join,
table->quick_key_parts[key] <= max_key_part && table->quick_key_parts[key] <= max_key_part &&
const_part & const_part &
((key_part_map)1 << table->quick_key_parts[key]) && ((key_part_map)1 << table->quick_key_parts[key]) &&
table->quick_n_ranges[key] == 1 + test(ref_or_null_part & table->quick_n_ranges[key] == 1 + MY_TEST(ref_or_null_part &
const_part) && const_part) &&
records > (double) table->quick_rows[key]) records > (double) table->quick_rows[key])
{ {
@ -6192,7 +6192,7 @@ best_access_path(JOIN *join,
best_key= 0; best_key= 0;
/* range/index_merge/ALL/index access method are "independent", so: */ /* range/index_merge/ALL/index access method are "independent", so: */
best_ref_depends_map= 0; best_ref_depends_map= 0;
best_uses_jbuf= test(!disable_jbuf && !((s->table->map & best_uses_jbuf= MY_TEST(!disable_jbuf && !((s->table->map &
join->outer_join))); 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 prune_level= join->thd->variables.optimizer_prune_level;
uint use_cond_selectivity= uint use_cond_selectivity=
join->thd->variables.optimizer_use_condition_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"); DBUG_ENTER("choose_plan");
join->cur_embedding_map= 0; 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 | table_map local_tables= jtab->emb_sj_nest->nested_join->used_tables |
jtab->join->const_table_map | jtab->join->const_table_map |
OUTER_REF_TABLE_BIT; 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())) !are_tables_local(j, keyuse->val->used_tables()))
keyuse++; /* Skip other parts */ 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.items[i]=keyuse->val; // Save for cond removal
j->ref.cond_guards[i]= keyuse->cond_guard; j->ref.cond_guards[i]= keyuse->cond_guard;
if (keyuse->null_rejecting) 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 && else if (!((keyparts == keyinfo->user_defined_key_parts &&
((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)) || ((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)) ||
(keyparts > keyinfo->user_defined_key_parts && // true only for extended keys (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)) || keyparts == keyinfo->ext_key_parts)) ||
null_ref_key) null_ref_key)
{ {
@ -8796,7 +8796,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *temp_table)
functions are handled. functions are handled.
*/ */
// the temporary table was explicitly requested // 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 // the temporary table does not have a grouping expression
DBUG_ASSERT(!temp_table->group); DBUG_ASSERT(!temp_table->group);
} }
@ -10403,7 +10403,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
((options & SELECT_DESCRIBE) || !tab->cache->init())) ((options & SELECT_DESCRIBE) || !tab->cache->init()))
{ {
tab->icp_other_tables_ok= FALSE; tab->icp_other_tables_ok= FALSE;
return (2-test(!prev_cache)); return (2 - MY_TEST(!prev_cache));
} }
goto no_join_cache; goto no_join_cache;
case JT_SYSTEM: case JT_SYSTEM:
@ -10438,7 +10438,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
((options & SELECT_DESCRIBE) || !tab->cache->init())) ((options & SELECT_DESCRIBE) || !tab->cache->init()))
{ {
tab->icp_other_tables_ok= FALSE; tab->icp_other_tables_ok= FALSE;
return (4-test(!prev_cache)); return (4 - MY_TEST(!prev_cache));
} }
goto no_join_cache; goto no_join_cache;
} }
@ -10457,7 +10457,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
prev_cache= 0; prev_cache= 0;
if ((tab->cache= new JOIN_CACHE_BKA(join, tab, flags, prev_cache)) && if ((tab->cache= new JOIN_CACHE_BKA(join, tab, flags, prev_cache)) &&
((options & SELECT_DESCRIBE) || !tab->cache->init())) ((options & SELECT_DESCRIBE) || !tab->cache->init()))
return (6-test(!prev_cache)); return (6 - MY_TEST(!prev_cache));
goto no_join_cache; goto no_join_cache;
} }
else else
@ -10468,7 +10468,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
((options & SELECT_DESCRIBE) || !tab->cache->init())) ((options & SELECT_DESCRIBE) || !tab->cache->init()))
{ {
tab->idx_cond_fact_out= FALSE; tab->idx_cond_fact_out= FALSE;
return (8-test(!prev_cache)); return (8 - MY_TEST(!prev_cache));
} }
goto no_join_cache; goto no_join_cache;
} }
@ -10563,7 +10563,7 @@ restart:
no_jbuf_after, no_jbuf_after,
idx, idx,
prev_tab); 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 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 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; uint i;
DBUG_ENTER("make_join_readinfo"); 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; bool sorted= 1;
join->complex_firstmatch_tables= table_map(0); join->complex_firstmatch_tables= table_map(0);
@ -11191,7 +11191,7 @@ bool JOIN_TAB::preread_init()
/* init ftfuns for just initialized derived table */ /* init ftfuns for just initialized derived table */
if (table->fulltext_searched) 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; return FALSE;
} }
@ -11247,12 +11247,12 @@ bool TABLE_REF::tmp_table_index_lookup_init(THD *thd,
Item *item= it.next(); Item *item= it.next();
DBUG_ASSERT(item); DBUG_ASSERT(item);
items[i]= 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, *ref_key= new store_key_item(thd, cur_key_part->field,
/* TIMOUR: /* TIMOUR:
the NULL byte is taken into account in the NULL byte is taken into account in
cur_key_part->store_length, so instead of 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. use that information instead.
*/ */
cur_ref_buff + null_count, 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 */ 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) if (!item_const && field_sjm && field_sjm != current_sjm)
{ {
/* Entering an SJM nest */ /* 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; NESTED_JOIN *nested_join;
TABLE_LIST *prev_table= 0; TABLE_LIST *prev_table= 0;
List_iterator<TABLE_LIST> li(*join_list); 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"); DBUG_ENTER("simplify_joins");
/* /*
@ -14224,7 +14224,7 @@ optimize_cond(JOIN *join, COND *conds,
DBUG_EXECUTE("where", print_where(conds, "original", QT_ORDINARY);); DBUG_EXECUTE("where", print_where(conds, "original", QT_ORDINARY););
conds= build_equal_items(join, conds, NULL, join_list, conds= build_equal_items(join, conds, NULL, join_list,
ignore_on_conds, cond_equal, 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);); DBUG_EXECUTE("where",print_where(conds,"after equal_items", QT_ORDINARY););
/* change field = field to field = const for each found field = const */ /* 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 " ("table_alias: '%s' distinct: %d save_sum_fields: %d "
"rows_limit: %lu group: %d", table_alias, "rows_limit: %lu group: %d", table_alias,
(int) distinct, (int) save_sum_fields, (int) distinct, (int) save_sum_fields,
(ulong) rows_limit,test(group))); (ulong) rows_limit, MY_TEST(group)));
thd->inc_status_created_tmp_tables(); thd->inc_status_created_tmp_tables();
thd->query_plan_flags|= QPLAN_TMP_TABLE; 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 */ table->group=group; /* Table is grouped by key */
param->group_buff=group_buff; param->group_buff=group_buff;
share->keys=1; 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->key_info= table->s->key_info= keyinfo;
table->keys_in_use_for_query.set_bit(0); table->keys_in_use_for_query.set_bit(0);
share->keys_in_use.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, if (!(cur_group->field= field->new_key_field(thd->mem_root,table,
group_buff + group_buff +
test(maybe_null), MY_TEST(maybe_null),
field->null_ptr, field->null_ptr,
field->null_bit))) field->null_bit)))
goto err; /* purecov: inspected */ 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; null_pack_length-=hidden_null_pack_length;
keyinfo->user_defined_key_parts= keyinfo->user_defined_key_parts=
((field_count-param->hidden_field_count)+ ((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; keyinfo->ext_key_parts= keyinfo->user_defined_key_parts;
table->distinct= 1; table->distinct= 1;
share->keys= 1; share->keys= 1;
@ -17514,7 +17514,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
if (select_cond) 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 */ /* check for errors evaluating the condition */
if (join->thd->is_error()) 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(); (*tab->on_expr_ref)->update_used_tables();
DBUG_ASSERT((*tab->on_expr_ref)->const_item()); DBUG_ASSERT((*tab->on_expr_ref)->const_item());
#endif #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); mark_as_null_row(table);
} }
if (!table->null_row) if (!table->null_row)
@ -21353,7 +21353,7 @@ test_if_subpart(ORDER *a,ORDER *b)
else else
return 0; return 0;
} }
return test(!b); return MY_TEST(!b);
} }
/** /**

View File

@ -524,7 +524,7 @@ typedef struct st_join_table {
ha_rows get_examined_rows(); ha_rows get_examined_rows();
bool preread_init(); 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, bool access_from_tables_is_allowed(table_map used_tables,
table_map sjm_lookup_tables) table_map sjm_lookup_tables)
@ -1299,7 +1299,7 @@ public:
lock= thd_arg->lock; lock= thd_arg->lock;
select_lex= 0; //for safety select_lex= 0; //for safety
tmp_join= 0; tmp_join= 0;
select_distinct= test(select_options & SELECT_DISTINCT); select_distinct= MY_TEST(select_options & SELECT_DISTINCT);
no_order= 0; no_order= 0;
simple_order= 0; simple_order= 0;
simple_group= 0; simple_group= 0;
@ -1443,7 +1443,7 @@ public:
void set_allowed_join_cache_types(); void set_allowed_join_cache_types();
bool is_allowed_hash_join_access() 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; max_allowed_join_cache_level > JOIN_CACHE_HASHED_BIT;
} }
/* /*
@ -1462,7 +1462,7 @@ public:
return ((const_tables != table_count && return ((const_tables != table_count &&
((select_distinct || !simple_order || !simple_group) || ((select_distinct || !simple_order || !simple_group) ||
(group_list && order) || (group_list && order) ||
test(select_options & OPTION_BUFFER_RESULT))) || MY_TEST(select_options & OPTION_BUFFER_RESULT))) ||
(rollup.state != ROLLUP::STATE_NONE && select_distinct)); (rollup.state != ROLLUP::STATE_NONE && select_distinct));
} }
bool choose_subquery_plan(table_map join_tables); bool choose_subquery_plan(table_map join_tables);

View File

@ -885,7 +885,7 @@ public:
m_view_access_denied_message_ptr(NULL) 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; 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); end= longlong10_to_str(key_info->block_size, buff, 10);
packet->append(buff, (uint) (end - buff)); 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)); (key_info->comment.length > 0));
if (key_info->flags & HA_USES_COMMENT) 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); fill_record(thd, dst_table, dst_table->field, items, TRUE, FALSE);
res= dst_table->file->ha_write_tmp_row(dst_table->record[0]); res= dst_table->file->ha_write_tmp_row(dst_table->record[0]);
set_current_thd(cur_thd); 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) 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 #ifndef NO_EMBEDDED_ACCESS_CHECKS
uint col_access; uint col_access;
check_access(thd,SELECT_ACL, db_name->str, 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, col_access= get_column_grant(thd, &tables->grant,
db_name->str, table_name->str, db_name->str, table_name->str,
field->field_name) & COL_ACLS; 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[1]->store(option_name, strlen(option_name), scs);
table->field[2]->store(plugin_decl(plugin)->descr, table->field[2]->store(plugin_decl(plugin)->descr,
strlen(plugin_decl(plugin)->descr), scs); 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]->store(tmp->str, tmp->length, scs);
table->field[3]->set_notnull(); 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]->store(tmp->str, tmp->length, scs);
table->field[4]->set_notnull(); 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]->store(tmp->str, tmp->length, scs);
table->field[5]->set_notnull(); table->field[5]->set_notnull();
@ -6145,7 +6145,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
else else
table->field[14]->store("", 0, cs); table->field[14]->store("", 0, cs);
table->field[14]->set_notnull(); 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)); (key_info->comment.length > 0));
if (key_info->flags & HA_USES_COMMENT) if (key_info->flags & HA_USES_COMMENT)
table->field[15]->store(key_info->comment.str, table->field[15]->store(key_info->comment.str,

View File

@ -354,7 +354,7 @@ public:
bool is_null(uint stat_field_no) 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() double get_nulls_ratio()

View File

@ -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 with length (unlike blobs, where ft code takes data length from a
data prefix, ignoring column->length). 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 else
{ {
@ -5290,7 +5290,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
int result __attribute__((unused))= int result __attribute__((unused))=
store_create_info(thd, table, &query, store_create_info(thd, table, &query,
create_info, FALSE /* show_database */, create_info, FALSE /* show_database */,
test(create_info->options & MY_TEST(create_info->options &
HA_LEX_CREATE_REPLACE)); HA_LEX_CREATE_REPLACE));
DBUG_ASSERT(result == 0); // store_create_info() always return 0 DBUG_ASSERT(result == 0); // store_create_info() always return 0
@ -7385,7 +7385,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
key= new Key(key_type, key_name, strlen(key_name), key= new Key(key_type, key_name, strlen(key_name),
&key_create_info, &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); key_parts, key_info->option_list, FALSE);
new_key_list.push_back(key); 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"); DBUG_ENTER("copy_data_between_tables");
/* Two or 3 stages; Sorting, copying data and update indexes */ /* 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)) if (mysql_trans_prepare_alter_copy_data(thd))
DBUG_RETURN(-1); 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 **new_engine= &create_info->db_type;
handlerton *req_engine= *new_engine; handlerton *req_engine= *new_engine;
bool no_substitution= 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), if (!(*new_engine= ha_checktype(thd, ha_legacy_type(req_engine),
no_substitution, 1))) no_substitution, 1)))
DBUG_RETURN(true); DBUG_RETURN(true);

View File

@ -106,9 +106,9 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year)
uint days; uint days;
ulong daynr=calc_daynr(l_time->year,l_time->month,l_time->day); ulong daynr=calc_daynr(l_time->year,l_time->month,l_time->day);
ulong first_daynr=calc_daynr(l_time->year,1,1); ulong first_daynr=calc_daynr(l_time->year,1,1);
bool monday_first= test(week_behaviour & WEEK_MONDAY_FIRST); bool monday_first= MY_TEST(week_behaviour & WEEK_MONDAY_FIRST);
bool week_year= test(week_behaviour & WEEK_YEAR); bool week_year= MY_TEST(week_behaviour & WEEK_YEAR);
bool first_weekday= test(week_behaviour & WEEK_FIRST_WEEKDAY); bool first_weekday= MY_TEST(week_behaviour & WEEK_FIRST_WEEKDAY);
uint weekday=calc_weekday(first_daynr, !monday_first); uint weekday=calc_weekday(first_daynr, !monday_first);
*year=l_time->year; *year=l_time->year;

View File

@ -243,7 +243,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
bool is_union_select; bool is_union_select;
DBUG_ENTER("st_select_lex_unit::prepare"); 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 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) if (global_parameters->ftfunc_list->elements)
create_options= create_options | TMP_TABLE_FORCE_MYISAM; 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)) create_options, "", FALSE, TRUE))
goto err; goto err;
if (fake_select_lex && !fake_select_lex->first_cond_optimization) 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() List<Item> *st_select_lex_unit::get_unit_column_types()
{ {
SELECT_LEX *sl= first_select(); SELECT_LEX *sl= first_select();
bool is_procedure= test(sl->join->procedure); bool is_procedure= MY_TEST(sl->join->procedure);
if (is_procedure) if (is_procedure)
{ {

View File

@ -255,7 +255,7 @@ int mysql_update(THD *thd,
ha_rows *found_return, ha_rows *updated_return) ha_rows *found_return, ha_rows *updated_return)
{ {
bool using_limit= limit != HA_POS_ERROR; 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 used_key_is_modified= FALSE, transactional_table, will_batch;
bool can_compare_record; bool can_compare_record;
int res; int res;
@ -314,7 +314,7 @@ int mysql_update(THD *thd,
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE"); my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE");
DBUG_RETURN(1); 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 */ /* Calculate "table->covering_keys" based on the WHERE */
table->covering_keys= table->s->keys_in_use; table->covering_keys= table->s->keys_in_use;

View File

@ -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) (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->push_backpatch(i, ctx->push_label(current_thd, empty_lex_str, 0)) ||
sp->add_cont_backpatch(i) || sp->add_cont_backpatch(i) ||
sp->add_instr(i); sp->add_instr(i);
@ -362,7 +362,7 @@ int case_stmt_action_then(LEX *lex)
sp_pcontext *ctx= lex->spcont; sp_pcontext *ctx= lex->spcont;
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump *i = new sp_instr_jump(ip, ctx); 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; return 1;
/* /*

View File

@ -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 *sv= (type == OPT_GLOBAL) ? &global_system_variables : &thd->variables;
sv->engine_condition_pushdown= 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; return false;
} }
static Sys_var_flagset Sys_optimizer_switch( 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) 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( static Sys_var_session_special Sys_in_transaction(
"in_transaction", "Whether there is an active transaction", "in_transaction", "Whether there is an active transaction",

View File

@ -819,7 +819,7 @@ static bool create_key_infos(const uchar *strpos, const uchar *frm_image_end,
keyinfo->comment.length); keyinfo->comment.length);
strpos+= keyinfo->comment.length; strpos+= keyinfo->comment.length;
} }
DBUG_ASSERT(test(keyinfo->flags & HA_USES_COMMENT) == DBUG_ASSERT(MY_TEST(keyinfo->flags & HA_USES_COMMENT) ==
(keyinfo->comment.length > 0)); (keyinfo->comment.length > 0));
} }
@ -2889,9 +2889,9 @@ partititon_err:
else if (outparam->file) else if (outparam->file)
{ {
handler::Table_flags flags= outparam->file->ha_table_flags(); handler::Table_flags flags= outparam->file->ha_table_flags();
outparam->no_replicate= ! test(flags & (HA_BINLOG_STMT_CAPABLE outparam->no_replicate= ! MY_TEST(flags & (HA_BINLOG_STMT_CAPABLE
| HA_BINLOG_ROW_CAPABLE)) | HA_BINLOG_ROW_CAPABLE))
|| test(flags & HA_HAS_OWN_BINLOGGING); || MY_TEST(flags & HA_HAS_OWN_BINLOGGING);
} }
else else
{ {
@ -3253,7 +3253,7 @@ void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
/* header */ /* header */
fileinfo[0]=(uchar) 254; fileinfo[0]=(uchar) 254;
fileinfo[1]= 1; 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( fileinfo[3]= (uchar) ha_legacy_type(
ha_checktype(thd,ha_legacy_type(create_info->db_type),0,0)); ha_checktype(thd,ha_legacy_type(create_info->db_type),0,0));
@ -3272,7 +3272,7 @@ void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
*/ */
for (i= 0; i < keys; i++) for (i= 0; i < keys; i++)
{ {
DBUG_ASSERT(test(key_info[i].flags & HA_USES_COMMENT) == DBUG_ASSERT(MY_TEST(key_info[i].flags & HA_USES_COMMENT) ==
(key_info[i].comment.length > 0)); (key_info[i].comment.length > 0));
if (key_info[i].flags & HA_USES_COMMENT) if (key_info[i].flags & HA_USES_COMMENT)
key_comment_total_bytes += 2 + key_info[i].comment.length; key_comment_total_bytes += 2 + key_info[i].comment.length;
@ -6183,7 +6183,7 @@ bool TABLE::is_filled_at_execution()
do not have a corresponding table reference. Such tables are filled do not have a corresponding table reference. Such tables are filled
during execution. during execution.
*/ */
return test(!pos_in_table_list || return MY_TEST(!pos_in_table_list ||
pos_in_table_list->jtbm_subselect || pos_in_table_list->jtbm_subselect ||
pos_in_table_list->is_active_sjm()); pos_in_table_list->is_active_sjm());
} }

View File

@ -2194,7 +2194,7 @@ struct TABLE_LIST
*/ */
char *get_table_name() const { return view != NULL ? view_name.str : table_name; } char *get_table_name() const { return view != NULL ? view_name.str : table_name; }
bool is_active_sjm(); 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_unit *get_unit();
st_select_lex *get_single_select(); st_select_lex *get_single_select();
void wrap_into_nested_join(List<TABLE_LIST> &join_list); void wrap_into_nested_join(List<TABLE_LIST> &join_list);

View File

@ -138,7 +138,7 @@ bool trans_begin(THD *thd, uint flags)
thd->server_status&= thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); 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); thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
@ -172,7 +172,7 @@ bool trans_begin(THD *thd, uint flags)
compatibility. compatibility.
*/ */
const bool user_is_super= 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) if (opt_readonly && !user_is_super)
{ {
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only"); 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) if (flags & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT)
res= ha_start_consistent_snapshot(thd); 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->transaction.all.modified_non_trans_table= FALSE;
thd->lex->start_transaction_opt= 0; 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&= thd->server_status&=
~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY);
DBUG_PRINT("info", ("clearing SERVER_STATUS_IN_TRANS")); 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); 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->transaction.all.modified_non_trans_table= FALSE;
thd->lex->start_transaction_opt= 0; 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. */ /* Rollback should clear transaction_rollback_request flag. */
DBUG_ASSERT(! thd->transaction_rollback_request); 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(); 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) if (!res && !binlog_on)
thd->mdl_context.rollback_to_savepoint(sv->mdl_savepoint); 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; 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) else if (xa_state == XA_IDLE && thd->lex->xa_opt == XA_ONE_PHASE)
{ {
int r= ha_commit_trans(thd, TRUE); 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)); my_error(r == 1 ? ER_XA_RBROLLBACK : ER_XAER_RMERR, MYF(0));
} }
else if (xa_state == XA_PREPARED && thd->lex->xa_opt == XA_NONE) 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"); 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) if (res)
my_error(ER_XAER_RMERR, MYF(0)); my_error(ER_XAER_RMERR, MYF(0));
} }

View File

@ -2822,7 +2822,7 @@ main(int argc, char **argv)
if (TYPE_SIGNED(time_t)) if (TYPE_SIGNED(time_t))
{ {
t= -100; 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 \ printf("localtime_r %s negative params \
(time_t=%d is %d-%d-%d %d:%d:%d)\n", (time_t=%d is %d-%d-%d %d:%d:%d)\n",
(localtime_negative ? "supports" : "doesn't support"), (int)t, (localtime_negative ? "supports" : "doesn't support"), (int)t,

View File

@ -86,7 +86,7 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
full_size= size; full_size= size;
if (min_dupl_count_arg) if (min_dupl_count_arg)
full_size+= sizeof(element_count); full_size+= sizeof(element_count);
with_counters= test(min_dupl_count_arg); with_counters= MY_TEST(min_dupl_count_arg);
my_b_clear(&file); my_b_clear(&file);
init_tree(&tree, (ulong) (max_in_memory_size / 16), 0, size, comp_func, init_tree(&tree, (ulong) (max_in_memory_size / 16), 0, size, comp_func,
NULL, comp_func_fixed_arg, MYF(MY_THREAD_SPECIFIC)); NULL, comp_func_fixed_arg, MYF(MY_THREAD_SPECIFIC));

View File

@ -280,7 +280,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
int2store(forminfo+2, frm.length - filepos); int2store(forminfo+2, frm.length - filepos);
int4store(fileinfo+10, frm.length); int4store(fileinfo+10, frm.length);
fileinfo[26]= (uchar) test((create_info->max_rows == 1) && fileinfo[26]= (uchar) MY_TEST((create_info->max_rows == 1) &&
(create_info->min_rows == 1) && (keys == 0)); (create_info->min_rows == 1) && (keys == 0));
int2store(fileinfo+28,key_info_length); int2store(fileinfo+28,key_info_length);
@ -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) 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->sql_type;
*buff++= (uchar) field->stored_in_db; *buff++= (uchar) field->stored_in_db;
if (field->interval) if (field->interval)

View File

@ -1466,7 +1466,7 @@ prepare_for_next_key_part:
ptr was incremented by 1. Since store_length still counts null-byte, ptr was incremented by 1. Since store_length still counts null-byte,
we need to subtract 1 from store_length. 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 "))) if (tmp.append(STRING_WITH_LEN(" AND ")))
goto err; 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? Because we only are updating one record, and LIMIT enforces
this. 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 buffers for following strings

View File

@ -1386,7 +1386,7 @@ prepare_for_next_key_part:
ptr was incremented by 1. Since store_length still counts null-byte, ptr was incremented by 1. Since store_length still counts null-byte,
we need to subtract 1 from store_length. 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 "))) if (tmp.append(STRING_WITH_LEN(" AND ")))
goto err; 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? Because we only are updating one record, and LIMIT enforces
this. 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 buffers for following strings

View File

@ -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) 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)) if (internal_table || (!(file= heap_open(name, mode)) && my_errno == ENOENT))
{ {
HP_CREATE_INFO create_info; HP_CREATE_INFO create_info;
@ -106,7 +106,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
if (rc) if (rc)
goto end; goto end;
implicit_emptied= test(created_new_share); implicit_emptied= MY_TEST(created_new_share);
if (internal_table) if (internal_table)
file= heap_open_from_share(internal_share, mode); file= heap_open_from_share(internal_share, mode);
else else

View File

@ -640,7 +640,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
{ {
if (seg->null_bit) 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++) if (found_null != (int) *key++)
return 1; return 1;
if (found_null) if (found_null)
@ -737,7 +737,7 @@ void hp_make_key(HP_KEYDEF *keydef, uchar *key, const uchar *rec)
uint char_length= seg->length; uint char_length= seg->length;
uchar *pos= (uchar*) rec + seg->start; uchar *pos= (uchar*) rec + seg->start;
if (seg->null_bit) 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) if (cs->mbmaxlen > 1)
{ {
char_length= my_charpos(cs, pos, pos + seg->length, 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; uint char_length;
if (seg->null_bit) 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; continue;
} }
if (seg->flag & HA_SWAP_KEY) if (seg->flag & HA_SWAP_KEY)

View File

@ -724,8 +724,8 @@ int maria_check_definition(MARIA_KEYDEF *t1_keyinfo,
{ {
DBUG_PRINT("error", ("Key %d has different definition", i)); DBUG_PRINT("error", ("Key %d has different definition", i));
DBUG_PRINT("error", ("t1_fulltext= %d, t2_fulltext=%d", DBUG_PRINT("error", ("t1_fulltext= %d, t2_fulltext=%d",
test(t1_keyinfo[i].flag & HA_FULLTEXT), MY_TEST(t1_keyinfo[i].flag & HA_FULLTEXT),
test(t2_keyinfo[i].flag & HA_FULLTEXT))); MY_TEST(t2_keyinfo[i].flag & HA_FULLTEXT)));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (t1_keyinfo[i].flag & HA_SPATIAL && t2_keyinfo[i].flag & HA_SPATIAL) 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", ("Key %d has different definition", i));
DBUG_PRINT("error", ("t1_spatial= %d, t2_spatial=%d", DBUG_PRINT("error", ("t1_spatial= %d, t2_spatial=%d",
test(t1_keyinfo[i].flag & HA_SPATIAL), MY_TEST(t1_keyinfo[i].flag & HA_SPATIAL),
test(t2_keyinfo[i].flag & HA_SPATIAL))); MY_TEST(t2_keyinfo[i].flag & HA_SPATIAL)));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs || 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)))) share->pack.header_length, 1, MYF(MY_WME))))
{ {
error= maria_chk_data_link(&param, file, error= maria_chk_data_link(&param, file,
test(param.testflag & T_EXTEND)); MY_TEST(param.testflag & T_EXTEND));
end_io_cache(&(param.read_cache)); end_io_cache(&(param.read_cache));
} }
param.testflag= old_testflag; 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); thd_proc_info(thd, buf);
param->testflag|= T_REP_PARALLEL; param->testflag|= T_REP_PARALLEL;
error= maria_repair_parallel(param, file, fixed_name, 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 */ /* to reset proc_info, as it was pointing to local buffer */
thd_proc_info(thd, "Repair done"); 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"); thd_proc_info(thd, "Repair by sorting");
param->testflag|= T_REP_BY_SORT; param->testflag|= T_REP_BY_SORT;
error= maria_repair_by_sort(param, file, fixed_name, 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 && if (error && file->create_unique_index_by_sort &&
share->state.dupp_key != MAX_KEY) 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"); thd_proc_info(thd, "Repair with keycache");
param->testflag &= ~(T_REP_BY_SORT | T_REP_PARALLEL); param->testflag &= ~(T_REP_BY_SORT | T_REP_PARALLEL);
error= maria_repair(param, file, fixed_name, 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); param->testflag= save_testflag | (param->testflag & T_RETRY_WITHOUT_QUICK);
optimize_done= 1; 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 set full_repair_done if we re-wrote all rows and all keys
(and thus removed all transid's from the table (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) if (!error)
{ {
@ -2124,7 +2124,7 @@ void ha_maria::start_bulk_insert(ha_rows rows, uint flags)
} }
else 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); maria_disable_indexes_for_rebuild(file, rows, all_keys);
} }
if (share->now_transactional) if (share->now_transactional)
@ -3300,7 +3300,7 @@ static int maria_rollback(handlerton *hton __attribute__ ((unused)),
bool maria_flush_logs(handlerton *hton) bool maria_flush_logs(handlerton *hton)
{ {
return test(translog_purge_at_flush()); return MY_TEST(translog_purge_at_flush());
} }

View File

@ -146,7 +146,7 @@ public:
bool auto_repair(int error) const bool auto_repair(int error) const
{ {
/* Always auto-repair moved tables (error == HA_ERR_OLD_FILE) */ /* 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_CRASHED_ON_USAGE) ||
error == HA_ERR_OLD_FILE); error == HA_ERR_OLD_FILE);

View File

@ -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", DBUG_PRINT("error", ("page: %lu page_count: %u tail: %u length: %ld data_length: %ld",
(ulong) block->page, (ulong) block->page,
(block->page_count & ~TAIL_BIT), (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)) * (ulong) ((block->page + (page_count & ~TAIL_BIT)) *
share->block_size), share->block_size),
(ulong) share->state.state.data_file_length)); (ulong) share->state.state.data_file_length));

View File

@ -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 (param->testflag & (T_EXTEND | T_MEDIUM | T_VERBOSE))
{ {
if (_ma_rec_check(info,record, info->rec_buff,block_info.rec_len, 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", _ma_check_print_error(param,"Found wrong packed record at %s",
llstr(start_recpos,llbuff)); 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->sort_info= sort_info;
sort_param->fix_datafile= ! rep_quick; 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->info= sort_info->new_info= info;
sort_info->param= param; sort_info->param= param;
set_data_file_type(sort_info, info->s); set_data_file_type(sort_info, info->s);
@ -2395,7 +2395,8 @@ static int initialize_variables_for_repair(HA_CHECK *param,
info->rec_cache.file= info->dfile.file; info->rec_cache.file= info->dfile.file;
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
if (protect_against_repair_crash(info, param, !test(param->testflag & if (protect_against_repair_crash(info, param,
!MY_TEST(param->testflag &
T_CREATE_MISSING_KEYS))) T_CREATE_MISSING_KEYS)))
return 1; return 1;
@ -3836,7 +3837,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
if (keyseg[i].flag & HA_SPACE_PACK) if (keyseg[i].flag & HA_SPACE_PACK)
sort_param.key_length+=get_pack_length(keyseg[i].length); sort_param.key_length+=get_pack_length(keyseg[i].length);
if (keyseg[i].flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART)) 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) if (keyseg[i].flag & HA_NULL_PART)
sort_param.key_length++; 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) if (keyseg->flag & HA_SPACE_PACK)
sort_param[i].key_length+=get_pack_length(keyseg->length); sort_param[i].key_length+=get_pack_length(keyseg->length);
if (keyseg->flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART)) 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) if (keyseg->flag & HA_NULL_PART)
sort_param[i].key_length++; 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_info.total_keys=i;
sort_param[0].master= 1; sort_param[0].master= 1;
sort_param[0].fix_datafile= ! rep_quick; 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)) if (!maria_ftparser_alloc_param(info))
goto err; goto err;
@ -5225,7 +5226,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param)
sort_param->find_length, sort_param->find_length,
(param->testflag & T_QUICK) && (param->testflag & T_QUICK) &&
sort_param->calc_checksum && 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", _ma_check_print_info(param,"Found wrong packed record at %s",
llstr(sort_param->start_recpos,llbuff)); llstr(sort_param->start_recpos,llbuff));
@ -5413,7 +5414,7 @@ int _ma_sort_write_record(MARIA_SORT_PARAM *sort_param)
do 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) if (block_length < share->base.min_block_length)
block_length=share->base.min_block_length; block_length=share->base.min_block_length;
info->update|=HA_STATE_WRITE_AT_END; 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; const uchar *end=buf+length;
for (crc=0; buf != end; buf++) for (crc=0; buf != end; buf++)
crc=((crc << 1) + *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; return crc;
} }

View File

@ -209,7 +209,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
options|= HA_OPTION_NULL_FIELDS; /* Use ma_checksum() */ options|= HA_OPTION_NULL_FIELDS; /* Use ma_checksum() */
/* We must test for 257 as length includes pack-length */ /* We must test for 257 as length includes pack-length */
if (test(column->length >= 257)) if (MY_TEST(column->length >= 257))
{ {
long_varchar_count++; long_varchar_count++;
max_field_lengths++; max_field_lengths++;
@ -308,7 +308,8 @@ int maria_create(const char *name, enum data_file_type datafile_type,
pack_bytes= (packed + 7) / 8; pack_bytes= (packed + 7) / 8;
if (pack_reclength != INT_MAX32) if (pack_reclength != INT_MAX32)
pack_reclength+= reclength+pack_bytes + 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; min_pack_length+= pack_bytes;
/* Calculate min possible row length for rows-in-block */ /* Calculate min possible row length for rows-in-block */
extra_header_size= MAX_FIXED_HEADER_SIZE; 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.records=ci->max_rows;
share.base.reloc= ci->reloc_rows; share.base.reloc= ci->reloc_rows;
share.base.reclength=real_reclength; 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.max_pack_length=pack_reclength;
share.base.min_pack_length=min_pack_length; share.base.min_pack_length=min_pack_length;
share.base.pack_bytes= pack_bytes; 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 remember if the data file was created or not, to know if Recovery can
do it or not, in the future 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, kfile_size_before_extension);
int2store(log_data + 1 + 2, share.base.keystart); int2store(log_data + 1 + 2, share.base.keystart);
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (uchar *)name; log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (uchar *)name;

View File

@ -406,7 +406,7 @@ static int _ma_find_writepos(MARIA_HA *info,
{ {
/* No deleted blocks; Allocate a new block */ /* No deleted blocks; Allocate a new block */
*filepos=info->state->data_file_length; *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) info->s->base.min_block_length)
tmp= info->s->base.min_block_length; tmp= info->s->base.min_block_length;
else else
@ -849,7 +849,7 @@ static my_bool update_dynamic_record(MARIA_HA *info, MARIA_RECORD_POS filepos,
if (length < reclength) if (length < reclength)
{ {
uint tmp=MY_ALIGN(reclength - length + 3 + 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 */ /* Don't create a block bigger than MARIA_MAX_BLOCK_LENGTH */
tmp= MY_MIN(length+tmp, MARIA_MAX_BLOCK_LENGTH)-length; tmp= MY_MIN(length+tmp, MARIA_MAX_BLOCK_LENGTH)-length;
/* Check if we can extend this block */ /* Check if we can extend this block */
@ -1014,7 +1014,7 @@ uint _ma_rec_pack(MARIA_HA *info, register uchar *to,
pos++; pos++;
} }
new_length=(uint) (end-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) < length)
{ {
if (column->length > 255 && new_length > 127) 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++; pos++;
} }
new_length=(uint) (end-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) < length)
{ {
if (!(flag & bit)) if (!(flag & bit))
@ -1191,7 +1191,7 @@ my_bool _ma_rec_check(MARIA_HA *info,const uchar *record, uchar *rec_buff,
to+= length; to+= length;
} }
if (packed_length != (uint) (to - rec_buff) + 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; goto err;
if (with_checksum && ((uchar) checksum != (uchar) *to)) if (with_checksum && ((uchar) checksum != (uchar) *to))
{ {

View File

@ -58,7 +58,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
{ {
reinit_io_cache(&info->rec_cache,READ_CACHE,0, reinit_io_cache(&info->rec_cache,READ_CACHE,0,
(pbool) (info->lock_type != F_UNLCK), (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 | 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, reinit_io_cache(&info->rec_cache, READ_CACHE, info->cur_row.nextpos,
(pbool) (info->lock_type != F_UNLCK), (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; info->update&= ~HA_STATE_ROW_CHANGED;
if (share->non_transactional_concurrent_insert) if (share->non_transactional_concurrent_insert)
info->rec_cache.end_of_file= info->state->data_file_length; 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 */ /* Fall trough */
case HA_EXTRA_PREPARE_FOR_RENAME: 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; my_bool save_global_changed;
enum flush_type type; enum flush_type type;
/* /*

View File

@ -523,7 +523,7 @@ static void _ftb_init_index_search(FT_INFO *ftb)
{ {
if (ftbe->flags & FTB_FLAG_NO || /* 2 */ if (ftbe->flags & FTB_FLAG_NO || /* 2 */
ftbe->up->ythresh - ftbe->up->yweaks > 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; FTB_EXPR *top_ftbe=ftbe->up;
ftbw->docid[0]=HA_OFFSET_ERROR; ftbw->docid[0]=HA_OFFSET_ERROR;

View File

@ -535,7 +535,7 @@ int _ma_decrement_open_count(MARIA_HA *info, my_bool lock_tables)
if (!lock_error && !my_disable_locking && lock_tables) if (!lock_error && !my_disable_locking && lock_tables)
lock_error=maria_lock_database(info,old_lock); lock_error=maria_lock_database(info,old_lock);
} }
DBUG_RETURN(test(lock_error || write_error)); DBUG_RETURN(MY_TEST(lock_error || write_error));
} }

Some files were not shown because too many files have changed in this diff Show More