Skip to content

Commit c3f841f

Browse files
committed
Merge from mysql-5.6 to mysql-trunk
2 parents 67d2e4e + 058b2ee commit c3f841f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+332
-332
lines changed

client/mysql.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ static my_bool execute_buffer_conversion_done= 0;
233233
The same is true for stderr.
234234
*/
235235
static uint win_is_console_cache=
236-
(test(my_win_is_console(stdout)) * (1 << _fileno(stdout))) |
237-
(test(my_win_is_console(stderr)) * (1 << _fileno(stderr)));
236+
(MY_TEST(my_win_is_console(stdout)) * (1 << _fileno(stdout))) |
237+
(MY_TEST(my_win_is_console(stderr)) * (1 << _fileno(stderr)));
238238

239239
static inline my_bool
240240
my_win_is_console_cached(FILE *file)

include/my_global.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ typedef unsigned short ushort;
304304
#endif
305305

306306
#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
307-
#define test(a) ((a) ? 1 : 0)
307+
#define MY_TEST(a) ((a) ? 1 : 0)
308308
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
309309
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
310310
#define test_all_bits(a,b) (((a) & (b)) == (b))

include/myisam.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ extern "C" {
8080

8181
#define mi_is_key_active(_keymap_,_keyno_) \
8282
(((_keyno_) < MI_KEYMAP_BITS) ? \
83-
test((_keymap_) & (ULL(1) << (_keyno_))) : \
84-
test((_keymap_) & MI_KEYMAP_HIGH_MASK))
83+
MY_TEST((_keymap_) & (ULL(1) << (_keyno_))) : \
84+
MY_TEST((_keymap_) & MI_KEYMAP_HIGH_MASK))
8585
#define mi_set_key_active(_keymap_,_keyno_) \
8686
(_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \
8787
(ULL(1) << (_keyno_)) : \
@@ -94,7 +94,7 @@ extern "C" {
9494
#else
9595

9696
#define mi_is_key_active(_keymap_,_keyno_) \
97-
test((_keymap_) & (ULL(1) << (_keyno_)))
97+
MY_TEST((_keymap_) & (ULL(1) << (_keyno_)))
9898
#define mi_set_key_active(_keymap_,_keyno_) \
9999
(_keymap_)|= (ULL(1) << (_keyno_))
100100
#define mi_clear_key_active(_keymap_,_keyno_) \
@@ -103,7 +103,7 @@ extern "C" {
103103
#endif
104104

105105
#define mi_is_any_key_active(_keymap_) \
106-
test((_keymap_))
106+
MY_TEST((_keymap_))
107107
#define mi_is_all_keys_active(_keymap_,_keys_) \
108108
((_keymap_) == mi_get_mask_all_keys_active(_keys_))
109109
#define mi_set_all_keys_active(_keymap_,_keys_) \

libmysql/libmysql.c

+14-14
Original file line numberDiff line numberDiff line change
@@ -2070,9 +2070,9 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
20702070
buff[4]= (char) stmt->flags;
20712071
int4store(buff+5, 1); /* iteration count */
20722072

2073-
res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
2074-
(uchar*) packet, length, 1, stmt) ||
2075-
(*mysql->methods->read_query_result)(mysql));
2073+
res= MY_TEST(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff),
2074+
(uchar*) packet, length, 1, stmt) ||
2075+
(*mysql->methods->read_query_result)(mysql));
20762076
stmt->affected_rows= mysql->affected_rows;
20772077
stmt->server_status= mysql->server_status;
20782078
stmt->insert_id= mysql->insert_id;
@@ -2559,7 +2559,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
25592559
reinit_result_set_metadata(stmt);
25602560
prepare_to_fetch_result(stmt);
25612561
}
2562-
DBUG_RETURN(test(stmt->last_errno));
2562+
DBUG_RETURN(MY_TEST(stmt->last_errno));
25632563
}
25642564

25652565

@@ -3179,15 +3179,15 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
31793179
int err;
31803180
double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err);
31813181
float fdata= (float) data;
3182-
*param->error= (fdata != data) | test(err);
3182+
*param->error= (fdata != data) | MY_TEST(err);
31833183
floatstore(buffer, fdata);
31843184
break;
31853185
}
31863186
case MYSQL_TYPE_DOUBLE:
31873187
{
31883188
int err;
31893189
double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err);
3190-
*param->error= test(err);
3190+
*param->error= MY_TEST(err);
31913191
doublestore(buffer, data);
31923192
break;
31933193
}
@@ -3196,7 +3196,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
31963196
MYSQL_TIME_STATUS status;
31973197
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
31983198
str_to_time(value, length, tm, &status);
3199-
*param->error= test(status.warnings);
3199+
*param->error= MY_TEST(status.warnings);
32003200
break;
32013201
}
32023202
case MYSQL_TYPE_DATE:
@@ -3206,7 +3206,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
32063206
MYSQL_TIME_STATUS status;
32073207
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
32083208
(void) str_to_datetime(value, length, tm, TIME_FUZZY_DATE, &status);
3209-
*param->error= test(status.warnings) &&
3209+
*param->error= MY_TEST(status.warnings) &&
32103210
(param->buffer_type == MYSQL_TYPE_DATE &&
32113211
tm->time_type != MYSQL_TIMESTAMP_DATE);
32123212
break;
@@ -3331,7 +3331,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
33313331
int error;
33323332
value= number_to_datetime(value, (MYSQL_TIME *) buffer, TIME_FUZZY_DATE,
33333333
&error);
3334-
*param->error= test(error);
3334+
*param->error= MY_TEST(error);
33353335
break;
33363336
}
33373337
default:
@@ -3678,7 +3678,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
36783678
static void fetch_result_tinyint(MYSQL_BIND *param, MYSQL_FIELD *field,
36793679
uchar **row)
36803680
{
3681-
my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG);
3681+
my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG);
36823682
uchar data= **row;
36833683
*(uchar *)param->buffer= data;
36843684
*param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX8;
@@ -3688,7 +3688,7 @@ static void fetch_result_tinyint(MYSQL_BIND *param, MYSQL_FIELD *field,
36883688
static void fetch_result_short(MYSQL_BIND *param, MYSQL_FIELD *field,
36893689
uchar **row)
36903690
{
3691-
my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG);
3691+
my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG);
36923692
ushort data= (ushort) sint2korr(*row);
36933693
shortstore(param->buffer, data);
36943694
*param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX16;
@@ -3699,7 +3699,7 @@ static void fetch_result_int32(MYSQL_BIND *param,
36993699
MYSQL_FIELD *field __attribute__((unused)),
37003700
uchar **row)
37013701
{
3702-
my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG);
3702+
my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG);
37033703
uint32 data= (uint32) sint4korr(*row);
37043704
longstore(param->buffer, data);
37053705
*param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX32;
@@ -3710,7 +3710,7 @@ static void fetch_result_int64(MYSQL_BIND *param,
37103710
MYSQL_FIELD *field __attribute__((unused)),
37113711
uchar **row)
37123712
{
3713-
my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG);
3713+
my_bool field_is_unsigned= MY_TEST(field->flags & UNSIGNED_FLAG);
37143714
ulonglong data= (ulonglong) sint8korr(*row);
37153715
*param->error= param->is_unsigned != field_is_unsigned && data > LONGLONG_MAX;
37163716
longlongstore(param->buffer, data);
@@ -4741,7 +4741,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
47414741
my_free(stmt->extension);
47424742
my_free(stmt);
47434743

4744-
DBUG_RETURN(test(rc));
4744+
DBUG_RETURN(MY_TEST(rc));
47454745
}
47464746

47474747
/*

libmysqld/lib_sql.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,9 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
337337
thd->client_param_count= stmt->param_count;
338338
thd->client_params= stmt->params;
339339

340-
res= test(emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE, 0, 0,
341-
header, sizeof(header), 1, stmt) ||
342-
emb_read_query_result(stmt->mysql));
340+
res= MY_TEST(emb_advanced_command(stmt->mysql, COM_STMT_EXECUTE, 0, 0,
341+
header, sizeof(header), 1, stmt) ||
342+
emb_read_query_result(stmt->mysql));
343343
stmt->affected_rows= stmt->mysql->affected_rows;
344344
stmt->insert_id= stmt->mysql->insert_id;
345345
stmt->server_status= stmt->mysql->server_status;

mysys/mf_iocache.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
176176
DBUG_ASSERT(seek_offset == 0);
177177
}
178178
else
179-
info->seek_not_done= test(seek_offset != pos);
179+
info->seek_not_done= MY_TEST(seek_offset != pos);
180180
}
181181

182182
info->disk_writes= 0;

mysys/my_copy.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ int my_copy(const char *from, const char *to, myf MyFlags)
6363
from_file=to_file= -1;
6464
DBUG_ASSERT(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */
6565
if (MyFlags & MY_HOLD_ORIGINAL_MODES) /* Copy stat if possible */
66-
new_file_stat= test(my_stat((char*) to, &new_stat_buff, MYF(0)));
66+
new_file_stat= MY_TEST(my_stat((char*) to, &new_stat_buff, MYF(0)));
6767

6868
if ((from_file=my_open(from,O_RDONLY | O_SHARE,MyFlags)) >= 0)
6969
{

mysys/my_getwd.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ int test_if_hard_path(const char *dir_name)
149149

150150
my_bool has_path(const char *name)
151151
{
152-
return test(strchr(name, FN_LIBCHAR))
152+
return MY_TEST(strchr(name, FN_LIBCHAR))
153153
#if FN_LIBCHAR != '/'
154-
|| test(strchr(name,'/'))
154+
|| MY_TEST(strchr(name,'/'))
155155
#endif
156156
#ifdef FN_DEVCHAR
157-
|| test(strchr(name, FN_DEVCHAR))
157+
|| MY_TEST(strchr(name, FN_DEVCHAR))
158158
#endif
159159
;
160160
}

sql-common/client.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
14711471
options->secure_auth= TRUE;
14721472
break;
14731473
case OPT_report_data_truncation:
1474-
options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1;
1474+
options->report_data_truncation= opt_arg ? MY_TEST(atoi(opt_arg)) : 1;
14751475
break;
14761476
case OPT_plugin_dir:
14771477
{
@@ -4642,7 +4642,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
46424642
mysql->options.protocol=MYSQL_PROTOCOL_PIPE; /* Force named pipe */
46434643
break;
46444644
case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/
4645-
if (!arg || test(*(uint*) arg))
4645+
if (!arg || MY_TEST(*(uint*) arg))
46464646
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
46474647
else
46484648
mysql->options.client_flag&= ~CLIENT_LOCAL_FILES;
@@ -4695,7 +4695,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
46954695
mysql->options.secure_auth= *(my_bool *) arg;
46964696
break;
46974697
case MYSQL_REPORT_DATA_TRUNCATION:
4698-
mysql->options.report_data_truncation= test(*(my_bool *) arg);
4698+
mysql->options.report_data_truncation= MY_TEST(*(my_bool *) arg);
46994699
break;
47004700
case MYSQL_OPT_RECONNECT:
47014701
mysql->reconnect= *(my_bool *) arg;

sql/auth/password.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ check_scramble_sha1(const uchar *scramble_arg, const char *message,
545545
/* now buf supposedly contains hash_stage1: so we can get hash_stage2 */
546546
compute_sha1_hash(hash_stage2_reassured, (const char *) buf, SHA1_HASH_SIZE);
547547

548-
return test(memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE));
548+
return MY_TEST(memcmp(hash_stage2, hash_stage2_reassured, SHA1_HASH_SIZE));
549549
}
550550

551551
my_bool

sql/auth/sql_authentication.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
12411241
if ((mpvio->client_capabilities & CLIENT_CONNECT_ATTRS) &&
12421242
read_client_connect_attrs(&ptr, &bytes_remaining_in_packet,
12431243
mpvio->charset_adapter->charset()))
1244-
return test(packet_error);
1244+
return MY_TEST(packet_error);
12451245

12461246
DBUG_PRINT("info", ("client_plugin=%s, restart", client_plugin));
12471247
/*

sql/auth/sql_authorization.cc

+10-10
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,9 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
10371037
static bool test_if_create_new_users(THD *thd)
10381038
{
10391039
Security_context *sctx= thd->security_ctx;
1040-
bool create_new_users= test(sctx->master_access & INSERT_ACL) ||
1040+
bool create_new_users= MY_TEST(sctx->master_access & INSERT_ACL) ||
10411041
(!opt_safe_user_create &&
1042-
test(sctx->master_access & CREATE_USER_ACL));
1042+
MY_TEST(sctx->master_access & CREATE_USER_ACL));
10431043
if (!create_new_users)
10441044
{
10451045
TABLE_LIST tl;
@@ -1269,8 +1269,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
12691269
/* Create user if needed */
12701270
error=replace_user_table(thd, tables[0].table, Str,
12711271
0, revoke_grant, create_new_users,
1272-
test(thd->variables.sql_mode &
1273-
MODE_NO_AUTO_CREATE_USER));
1272+
MY_TEST(thd->variables.sql_mode &
1273+
MODE_NO_AUTO_CREATE_USER));
12741274
if (error)
12751275
{
12761276
result= TRUE; // Remember error
@@ -1536,8 +1536,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
15361536
/* Create user if needed */
15371537
error=replace_user_table(thd, tables[0].table, Str,
15381538
0, revoke_grant, create_new_users,
1539-
test(thd->variables.sql_mode &
1540-
MODE_NO_AUTO_CREATE_USER));
1539+
MY_TEST(thd->variables.sql_mode &
1540+
MODE_NO_AUTO_CREATE_USER));
15411541
if (error)
15421542
{
15431543
result= TRUE; // Remember error
@@ -1764,8 +1764,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
17641764

17651765
if (replace_user_table(thd, tables[0].table, Str,
17661766
(!db ? rights : 0), revoke_grant, create_new_users,
1767-
test(thd->variables.sql_mode &
1768-
MODE_NO_AUTO_CREATE_USER)))
1767+
MY_TEST(thd->variables.sql_mode &
1768+
MODE_NO_AUTO_CREATE_USER)))
17691769
{
17701770
result= -1;
17711771
is_user_applied= false;
@@ -1940,7 +1940,7 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
19401940
{
19411941
TABLE_LIST *const t_ref=
19421942
tl->correspondent_table ? tl->correspondent_table : tl;
1943-
sctx = test(t_ref->security_ctx) ? t_ref->security_ctx : thd->security_ctx;
1943+
sctx = MY_TEST(t_ref->security_ctx) ? t_ref->security_ctx : thd->security_ctx;
19441944

19451945
const ACL_internal_table_access *access=
19461946
get_cached_table_access(&t_ref->grant.m_internal,
@@ -2152,7 +2152,7 @@ bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref,
21522152
GRANT_INFO *grant;
21532153
const char *db_name;
21542154
const char *table_name;
2155-
Security_context *sctx= test(table_ref->security_ctx) ?
2155+
Security_context *sctx= MY_TEST(table_ref->security_ctx) ?
21562156
table_ref->security_ctx : thd->security_ctx;
21572157

21582158
if (table_ref->view || table_ref->field_translation)

sql/event_db_repository.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
469469
end:
470470
event_table->file->ha_index_end();
471471

472-
DBUG_RETURN(test(ret));
472+
DBUG_RETURN(MY_TEST(ret));
473473
}
474474

475475

@@ -751,7 +751,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
751751
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
752752

753753
thd->variables.sql_mode= saved_mode;
754-
DBUG_RETURN(test(ret));
754+
DBUG_RETURN(MY_TEST(ret));
755755
}
756756

757757

@@ -866,7 +866,7 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
866866
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
867867

868868
thd->variables.sql_mode= saved_mode;
869-
DBUG_RETURN(test(ret));
869+
DBUG_RETURN(MY_TEST(ret));
870870
}
871871

872872

@@ -926,7 +926,7 @@ Event_db_repository::drop_event(THD *thd, LEX_STRING db, LEX_STRING name,
926926
close_thread_tables(thd);
927927
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
928928

929-
DBUG_RETURN(test(ret));
929+
DBUG_RETURN(MY_TEST(ret));
930930
}
931931

932932

@@ -1168,7 +1168,7 @@ update_timing_fields_for_event(THD *thd,
11681168
if (save_binlog_row_based)
11691169
thd->set_current_stmt_binlog_format_row();
11701170

1171-
DBUG_RETURN(test(ret));
1171+
DBUG_RETURN(MY_TEST(ret));
11721172
}
11731173

11741174

@@ -1245,7 +1245,7 @@ Event_db_repository::check_system_tables(THD *thd)
12451245
close_mysql_tables(thd);
12461246
}
12471247

1248-
DBUG_RETURN(test(ret));
1248+
DBUG_RETURN(MY_TEST(ret));
12491249
}
12501250

12511251
/**

sql/field.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1967,7 +1967,7 @@ type_conversion_status Field::store_time(MYSQL_TIME *ltime, uint8 dec_arg)
19671967

19681968
bool Field::optimize_range(uint idx, uint part)
19691969
{
1970-
return test(table->file->index_flags(idx, part, 1) & HA_READ_RANGE);
1970+
return MY_TEST(table->file->index_flags(idx, part, 1) & HA_READ_RANGE);
19711971
}
19721972

19731973

@@ -9659,7 +9659,7 @@ void Create_field::create_length_to_internal_length(void)
96599659
{
96609660
pack_length= length / 8;
96619661
/* We need one extra byte to store the bits we save among the null bits */
9662-
key_length= pack_length + test(length & 7);
9662+
key_length= pack_length + MY_TEST(length & 7);
96639663
}
96649664
break;
96659665
case MYSQL_TYPE_NEWDECIMAL:

0 commit comments

Comments
 (0)