cleanup: don't use my_getopt_is_args_separator()

only my_getopt should use it, because it changes my_getopt's behavior.
If one simply wants to skip the separator - don't ask it to be added
in the first place
This commit is contained in:
Sergei Golubchik 2019-10-13 00:19:54 +02:00
parent 3e56972712
commit f7b8d14490
6 changed files with 4 additions and 8 deletions

View file

@ -198,8 +198,7 @@ int main(int argc, char **argv)
}
for (argument= arguments+1 ; *argument ; argument++)
if (!my_getopt_is_args_separator(*argument)) /* skip arguments separator */
puts(*argument);
puts(*argument);
my_free(load_default_groups);
free_defaults(arguments);
my_end(0);

View file

@ -24,7 +24,6 @@ extern const char *my_defaults_extra_file;
extern const char *my_defaults_group_suffix;
extern const char *my_defaults_file;
extern my_bool my_getopt_use_args_separator;
extern my_bool my_getopt_is_args_separator(const char* arg);
extern int get_defaults_options(char **argv);
extern int my_load_defaults(const char *conf_file, const char **groups,

View file

@ -335,6 +335,7 @@ int get_defaults_options(char **argv)
if (*argv && !strcmp(*argv, "--print-defaults"))
{
my_print_defaults= 1;
my_getopt_use_args_separator= FALSE;
argv++;
}
@ -499,8 +500,7 @@ int my_load_defaults(const char *conf_file, const char **groups, int *argc,
printf("%s would have been started with the following arguments:\n",
**argv);
for (i=1 ; i < *argc ; i++)
if (!my_getopt_is_args_separator((*argv)[i])) /* skip arguments separator */
printf("%s ", (*argv)[i]);
printf("%s ", (*argv)[i]);
puts("");
DBUG_RETURN(4);
}

View file

@ -24,6 +24,7 @@
#include <my_getopt.h>
#include <errno.h>
my_bool my_getopt_is_args_separator(const char* arg);
typedef void (*init_func_p)(const struct my_option *option, void *variable,
longlong value);

View file

@ -854,8 +854,6 @@ void mysql_read_default_options(struct st_mysql_options *options,
char **option=argv;
while (*++option)
{
if (my_getopt_is_args_separator(option[0])) /* skip arguments separator */
continue;
/* DBUG_PRINT("info",("option: %s",option[0])); */
if (option[0][0] == '-' && option[0][1] == '-')
{

View file

@ -5350,7 +5350,6 @@ int mysqld_main(int argc, char **argv)
orig_argv= argv;
my_getopt_use_args_separator= TRUE;
load_defaults_or_exit(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv);
my_getopt_use_args_separator= FALSE;
defaults_argc= argc;
defaults_argv= argv;
remaining_argc= argc;