Skip to content

Commit

Permalink
Bug #25597667: REMOVE MY_BOOL
Browse files Browse the repository at this point in the history
Replace TRUE with true and FALSE with false, with some notable exceptions:

 - In SQL, where we keep talking about TRUE and FALSE.
 - In comments that talk about SQL.
 - In string literals, especially in the parser and such.
 - In InnoDB, which has its own “ibool” type and TRUE/FALSE definitions.
 - In NDB, which get their own TRUE and FALSE definitions in ndb_global.h.

Change-Id: I60ee30ec43d3f86399f5c2d11f4d411bef360500
  • Loading branch information
Steinar H. Gunderson committed Nov 17, 2017
1 parent a541fa2 commit 2673e92
Show file tree
Hide file tree
Showing 502 changed files with 6,242 additions and 6,247 deletions.
4 changes: 2 additions & 2 deletions client/base/abstract_program.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ void Abstract_program::run(int argc, char **argv)

this->aggregate_options();

my_getopt_use_args_separator= TRUE;
my_getopt_use_args_separator= true;
if (load_defaults("my",load_default_groups,&argc,&argv, &m_argv_alloc))
this->error(Message_data(
1, "Error during loading default options", Message_type_error));
my_getopt_use_args_separator= FALSE;
my_getopt_use_args_separator= false;

int ho_error= handle_options(&argc, &argv, this->get_options_array(),
Abstract_program::callback_option_parsed);
Expand Down
6 changes: 3 additions & 3 deletions client/check/mysqlcheck.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ get_one_option(int optid, const struct my_option *opt,
break;
case 'V': print_version(); exit(0);
case OPT_ENABLE_CLEARTEXT_PLUGIN:
using_opt_enable_cleartext_plugin= TRUE;
using_opt_enable_cleartext_plugin= true;
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
Expand Down Expand Up @@ -354,11 +354,11 @@ static int get_options(int *argc, char ***argv, MEM_ROOT *alloc)
exit(0);
}

my_getopt_use_args_separator= TRUE;
my_getopt_use_args_separator= true;
if ((ho_error= load_defaults("my", load_default_groups, argc, argv, alloc)) ||
(ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
my_getopt_use_args_separator= FALSE;
my_getopt_use_args_separator= false;

if (!what_to_do)
{
Expand Down
4 changes: 2 additions & 2 deletions client/dump/sql_formatter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ void Sql_formatter::format_sql_objects_definer(
{
object_sql.replace(definer_pos, (object_pos-definer_pos), "");
new_sql_stmt+= object_sql + "\n";
is_replaced= TRUE;
is_replaced= true;
}
else
new_sql_stmt+= object_sql + "\n";
Expand All @@ -457,7 +457,7 @@ void Sql_formatter::format_sql_objects_definer(
@param [in] table Table name
@return
@retval TRUE if it is innodb stats table else FALSE
@retval true if it is innodb stats table else false
*/
bool Sql_formatter::innodb_stats_tables(std::string db,
std::string table)
Expand Down
37 changes: 18 additions & 19 deletions client/mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ static uint my_end_arg;
static char * opt_mysql_unix_port=0;
static char *opt_bind_addr = NULL;
static int connect_flag=CLIENT_INTERACTIVE;
static bool opt_binary_mode= FALSE;
static bool opt_connect_expired_password= FALSE;
static bool opt_binary_mode= false;
static bool opt_connect_expired_password= false;
static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0,
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME,
Expand Down Expand Up @@ -240,7 +240,7 @@ const char *default_dbug_option="d:t:o,/tmp/mysql.trace";
For using this feature in test case, we add the option in debug code.
*/
#ifndef DBUG_OFF
static bool opt_build_completion_hash = FALSE;
static bool opt_build_completion_hash = false;
#endif

#ifdef _WIN32
Expand Down Expand Up @@ -1216,7 +1216,7 @@ inline int get_command_index(char cmd_char)

static int delimiter_index= -1;
static int charset_index= -1;
static bool real_binary_mode= FALSE;
static bool real_binary_mode= false;

#ifdef _WIN32
BOOL windows_ctrl_handler(DWORD fdwCtrlType)
Expand All @@ -1227,14 +1227,14 @@ BOOL windows_ctrl_handler(DWORD fdwCtrlType)
case CTRL_BREAK_EVENT:
handle_ctrlc_signal(SIGINT);
/* Indicate that signal has beed handled. */
return TRUE;
return true;
case CTRL_CLOSE_EVENT:
case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT:
handle_quit_signal(SIGINT + 1);
}
/* Pass signal to the next control handler function. */
return FALSE;
return false;
}
#endif

Expand Down Expand Up @@ -1296,13 +1296,13 @@ int main(int argc,char *argv[])
my_win_translate_command_line_args(&my_charset_utf8mb4_bin, &argc, &argv);
#endif

my_getopt_use_args_separator= TRUE;
my_getopt_use_args_separator= true;
if (load_defaults("my",load_default_groups,&argc,&argv,&argv_alloc))
{
my_end(0);
return EXIT_FAILURE;
}
my_getopt_use_args_separator= FALSE;
my_getopt_use_args_separator= false;

if (get_options(argc, (char **) argv))
{
Expand Down Expand Up @@ -1342,7 +1342,7 @@ int main(int argc,char *argv[])
signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
signal(SIGHUP, handle_quit_signal); // Catch SIGHUP to clean up
#else
SetConsoleCtrlHandler((PHANDLER_ROUTINE) windows_ctrl_handler, TRUE);
SetConsoleCtrlHandler((PHANDLER_ROUTINE) windows_ctrl_handler, true);
#endif


Expand Down Expand Up @@ -1945,7 +1945,7 @@ get_one_option(int optid, const struct my_option *opt MY_ATTRIBUTE((unused)),
using_opt_local_infile=1;
break;
case OPT_ENABLE_CLEARTEXT_PLUGIN:
using_opt_enable_cleartext_plugin= TRUE;
using_opt_enable_cleartext_plugin= true;
break;
case OPT_TEE:
if (argument == disabled_my_option)
Expand Down Expand Up @@ -2332,10 +2332,10 @@ static int read_and_execute(bool interactive)

/*
If the function is called by 'source' command, it will return to interactive
mode, so real_binary_mode should be FALSE. Otherwise, it will exit the
program, it is safe to set real_binary_mode to FALSE.
mode, so real_binary_mode should be false. Otherwise, it will exit the
program, it is safe to set real_binary_mode to false.
*/
real_binary_mode= FALSE;
real_binary_mode= false;
return status.exit_status;
}

Expand Down Expand Up @@ -3569,7 +3569,7 @@ com_go(String *buffer,char *line MY_ATTRIBUTE((unused)))
do
{
char *pos;
bool batchmode= (status.batch && verbose <= 1) ? TRUE : FALSE;
bool batchmode= (status.batch && verbose <= 1);
buff[0]= 0;

if (quick)
Expand Down Expand Up @@ -3976,13 +3976,13 @@ print_table_data(MYSQL_RES *result)
if (opt_binhex && is_binary_field(field))
print_as_hex(PAGER, cur[off], lengths[off], field_max_length);
else if (field_max_length > MAX_COLUMN_LENGTH)
tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, false);
else
{
if (num_flag[off] != 0) /* if it is numeric, we right-justify it */
tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, TRUE);
tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, true);
else
tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, FALSE);
tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, false);
}
tee_fputs(" |", PAGER);
}
Expand Down Expand Up @@ -5042,8 +5042,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
static void
init_connection_options(MYSQL *mysql)
{
bool handle_expired= (opt_connect_expired_password || !status.batch) ?
TRUE : FALSE;
bool handle_expired= (opt_connect_expired_password || !status.batch);

if (opt_init_command)
mysql_options(mysql, MYSQL_INIT_COMMAND, opt_init_command);
Expand Down
28 changes: 14 additions & 14 deletions client/mysql_config_editor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static char my_key[LOGIN_KEY_LEN];

static bool opt_verbose, opt_all, tty_password= 0, opt_warn,
opt_remove_host, opt_remove_pass, opt_remove_user,
opt_remove_socket, opt_remove_port, login_path_specified= FALSE;
opt_remove_socket, opt_remove_port, login_path_specified= false;

static int execute_commands(int command);
static int set_command(void);
Expand Down Expand Up @@ -261,7 +261,7 @@ my_set_command_get_one_option(int optid, const struct my_option *, char*)
"Exiting..");
return 1;
}
login_path_specified= TRUE;
login_path_specified= true;
break;
case '?':
usage_command(MY_CONFIG_SET);
Expand All @@ -283,7 +283,7 @@ my_remove_command_get_one_option(int optid, const struct my_option*, char*)
"Exiting..");
return 1;
}
login_path_specified= TRUE;
login_path_specified= true;
break;
case '?':
usage_command(MY_CONFIG_REMOVE);
Expand All @@ -305,7 +305,7 @@ my_print_command_get_one_option(int optid, const struct my_option*, char*)
"Exiting..");
return 1;
}
login_path_specified= TRUE;
login_path_specified= true;
break;
case '?':
usage_command(MY_CONFIG_PRINT);
Expand Down Expand Up @@ -428,7 +428,7 @@ static int do_handle_options(int argc, char *argv[])
command_list[i]= NULL;

if ((rc= my_handle_options(&argc, &argv, my_program_long_options,
my_program_get_one_option, command_list, FALSE)))
my_program_get_one_option, command_list, false)))
exit(rc);

if (argc == 0) /* No command specified. */
Expand Down Expand Up @@ -641,7 +641,7 @@ static int remove_command(void) {
/* Warn if no login path is specified. */
if (opt_warn &&
((locate_login_path (&file_buf, opt_login_path)) != NULL) &&
(login_path_specified == FALSE)
(login_path_specified == false)
)
{
int choice;
Expand Down Expand Up @@ -708,8 +708,8 @@ static int print_command(void)
Create the login file if it does not exist, check
and set its permissions and modes.
@return TRUE Error
FALSE Success
@return true Error
false Success
*/

static bool check_and_create_login_file(void)
Expand Down Expand Up @@ -838,10 +838,10 @@ static bool check_and_create_login_file(void)
goto error;
}

DBUG_RETURN(FALSE);
DBUG_RETURN(false);

error:
DBUG_RETURN(TRUE);
DBUG_RETURN(true);
}


Expand Down Expand Up @@ -976,7 +976,7 @@ static void remove_option(DYNAMIC_STRING *file_buf, const char *path_name,
char *start= NULL, *end= NULL;
char *search_str;
size_t search_len, shift_len;
bool option_found= FALSE;
bool option_found= false;

search_str= (char *) my_malloc(PSI_NOT_INSTRUMENTED,
(uint) strlen(option_name) + 2, MYF(MY_WME));
Expand All @@ -1001,7 +1001,7 @@ static void remove_option(DYNAMIC_STRING *file_buf, const char *path_name,
end= start;
while(*(++ end) != '\n')
{}
option_found= TRUE;
option_found= true;
break;
}
else
Expand Down Expand Up @@ -1171,7 +1171,7 @@ static int encrypt_and_write_file(DYNAMIC_STRING *file_buf)
{
DBUG_ENTER("encrypt_and_write_file");

bool done= FALSE;
bool done= false;
char cipher[MY_LINE_MAX], *tmp= NULL;
uint bytes_read=0, len= 0;
int enc_len= 0; // Can be negative.
Expand All @@ -1196,7 +1196,7 @@ static int encrypt_and_write_file(DYNAMIC_STRING *file_buf)
len ++;
else
{
done= TRUE;
done= true;
break;
}

Expand Down
Loading

0 comments on commit 2673e92

Please sign in to comment.