summaryrefslogtreecommitdiff
path: root/extra/mariabackup
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-02-05 14:57:46 +0200
committerMonty <monty@mariadb.org>2021-02-08 12:16:29 +0200
commit5d6ad2ad66a677b67f2377d7665d6c140dd93323 (patch)
tree85a54b1a982beb401f04d5bcb621a1166b33b653 /extra/mariabackup
parente30a3048dacca5180e8d7b2934d0b1fe44b4f383 (diff)
downloadmariadb-git-5d6ad2ad66a677b67f2377d7665d6c140dd93323.tar.gz
Added 'const' to arguments in get_one_option and find_typeset()
One should not change the program arguments! This change also reduces warnings from the icc compiler. Almost all changes are just syntax changes (adding const to 'get_one_option function' declarations). Other changes: - Added a few cast of 'argument' from 'const char*' to 'char *'. This was mainly in calls to 'external' functions we don't have control of. - Ensure that all reset of 'password command line argument' are similar. (In almost all cases it was just adding a comment and a cast) - In mysqlbinlog.cc and mysqld.cc there was a few cases that changed the command line argument. These places where changed to instead allocate the option in a MEM_ROOT to avoid changing the argument. Some of this code was changed to ensure that different programs did parsing the same way. Added a test case for the changes in mysqlbinlog.cc - Changed a few variables that took their value from command line options from 'char *' to 'const char *'.
Diffstat (limited to 'extra/mariabackup')
-rw-r--r--extra/mariabackup/innobackupex.cc4
-rw-r--r--extra/mariabackup/xbstream.cc7
-rw-r--r--extra/mariabackup/xtrabackup.cc11
-rw-r--r--extra/mariabackup/xtrabackup.h2
4 files changed, 13 insertions, 11 deletions
diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc
index 9e95d2e6b16..e874890ad27 100644
--- a/extra/mariabackup/innobackupex.cc
+++ b/extra/mariabackup/innobackupex.cc
@@ -88,7 +88,7 @@ char *opt_ibx_incremental_history_name = NULL;
char *opt_ibx_incremental_history_uuid = NULL;
char *opt_ibx_user = NULL;
-char *opt_ibx_password = NULL;
+const char *opt_ibx_password = NULL;
char *opt_ibx_host = NULL;
char *opt_ibx_defaults_group = NULL;
char *opt_ibx_socket = NULL;
@@ -731,7 +731,7 @@ indicates an error.\n");
static
my_bool
ibx_get_one_option(const struct my_option *opt,
- char *argument, const char *)
+ const char *argument, const char *)
{
switch(opt->id) {
case '?':
diff --git a/extra/mariabackup/xbstream.cc b/extra/mariabackup/xbstream.cc
index c22c7cc8f39..3fe9d17d86e 100644
--- a/extra/mariabackup/xbstream.cc
+++ b/extra/mariabackup/xbstream.cc
@@ -90,7 +90,7 @@ static int get_options(int *argc, char ***argv);
static int mode_create(int argc, char **argv);
static int mode_extract(int n_threads, int argc, char **argv);
static my_bool get_one_option(const struct my_option *opt,
- char *argument, const char *filename);
+ const char *argument, const char *filename);
int
main(int argc, char **argv)
@@ -138,7 +138,8 @@ get_options(int *argc, char ***argv)
int ho_error;
if ((ho_error= handle_options(argc, argv, my_long_options,
- get_one_option))) {
+ get_one_option)))
+ {
exit(EXIT_FAILURE);
}
@@ -191,7 +192,7 @@ set_run_mode(run_mode_t mode)
static
my_bool
-get_one_option(const struct my_option *opt, char *, const char *)
+get_one_option(const struct my_option *opt, const char *, const char *)
{
switch (opt->id) {
case 'c':
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index b8cdf4cd9db..495c7d7e2fe 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -311,7 +311,7 @@ char *opt_incremental_history_name;
char *opt_incremental_history_uuid;
char *opt_user;
-char *opt_password;
+const char *opt_password;
char *opt_host;
char *opt_defaults_group;
char *opt_socket;
@@ -1861,7 +1861,7 @@ check_if_param_set(const char *param)
my_bool
xb_get_one_option(const struct my_option *opt,
- char *argument, const char *)
+ const char *argument, const char *)
{
switch(opt->id) {
case 'h':
@@ -6348,9 +6348,10 @@ void handle_options(int argc, char **argv, char ***argv_server,
if (opt_password)
{
- char *argument= opt_password;
- char *start= argument;
- opt_password= my_strdup(PSI_NOT_INSTRUMENTED, opt_password, MYF(MY_FAE));
+ char *argument= (char*) opt_password;
+ char *start= (char*) opt_password;
+ opt_password= my_strdup(PSI_NOT_INSTRUMENTED, opt_password,
+ MYF(MY_FAE));
while (*argument)
*argument++= 'x'; // Destroy argument
if (*start)
diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h
index 6376849430c..aff7d1cb287 100644
--- a/extra/mariabackup/xtrabackup.h
+++ b/extra/mariabackup/xtrabackup.h
@@ -144,7 +144,7 @@ extern char *opt_incremental_history_name;
extern char *opt_incremental_history_uuid;
extern char *opt_user;
-extern char *opt_password;
+extern const char *opt_password;
extern char *opt_host;
extern char *opt_defaults_group;
extern char *opt_socket;