From 045771c05099cf75fea036fdc89308eb3c06549a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 1 Jul 2022 09:48:36 +0300 Subject: Fix most clang-15 -Wunused-but-set-variable Also, refactor trx_i_s_common_fill_table() to remove dead code. Warnings about yynerrs in Bison-generated yyparse() will remain for now. --- client/mysql.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'client/mysql.cc') diff --git a/client/mysql.cc b/client/mysql.cc index ea92c84e1d1..28311defc81 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3591,7 +3591,6 @@ print_table_data(MYSQL_RES *result) { String separator(256); MYSQL_ROW cur; - MYSQL_FIELD *field; bool *num_flag; num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); @@ -3603,7 +3602,7 @@ print_table_data(MYSQL_RES *result) mysql_field_seek(result,0); } separator.copy("+",1,charset_info); - while ((field = mysql_fetch_field(result))) + while (MYSQL_FIELD *field= mysql_fetch_field(result)) { uint length= column_names ? field->name_length : 0; if (quick) @@ -3625,7 +3624,7 @@ print_table_data(MYSQL_RES *result) { mysql_field_seek(result,0); (void) tee_fputs("|", PAGER); - for (uint off=0; (field = mysql_fetch_field(result)) ; off++) + while (MYSQL_FIELD *field= mysql_fetch_field(result)) { size_t name_length= (uint) strlen(field->name); size_t numcells= charset_info->cset->numcells(charset_info, @@ -3668,7 +3667,7 @@ print_table_data(MYSQL_RES *result) data_length= (uint) lengths[off]; } - field= mysql_fetch_field(result); + MYSQL_FIELD *field= mysql_fetch_field(result); field_max_length= field->max_length; /* -- cgit v1.2.1 From 7598ef4b2616c476ea38362a3f41c399c4bf530e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 10 Jul 2022 19:28:06 +0200 Subject: MDEV-28197 Linux mariadb-client build does not accept Unicode characters Apparently newer libedit is readline-compatible enough to be detected as a readline, with USE_NEW_READLINE_INTERFACE defined and USE_LIBEDIT_INTERFACE not defined. Let's set the locale unconditionally, independently from the readline/libedit variant. It's already happening anyway now, unless one specifies --default-character-set explicitly. --- client/mysql.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'client/mysql.cc') diff --git a/client/mysql.cc b/client/mysql.cc index 28311defc81..d429a014194 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -42,7 +42,7 @@ #include #include #include -#if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H) +#if defined(HAVE_LOCALE_H) #include #endif @@ -2684,6 +2684,9 @@ static void initialize_readline () /* Allow conditional parsing of the ~/.inputrc file. */ rl_readline_name= (char *) "mysql"; rl_terminal_name= getenv("TERM"); +#ifdef HAVE_SETLOCALE + setlocale(LC_ALL,""); +#endif /* Tell the completer that we want a crack first. */ #if defined(USE_NEW_READLINE_INTERFACE) @@ -2692,9 +2695,6 @@ static void initialize_readline () rl_add_defun("magic-space", (rl_command_func_t *)&fake_magic_space, -1); #elif defined(USE_LIBEDIT_INTERFACE) -#ifdef HAVE_LOCALE_H - setlocale(LC_ALL,""); /* so as libedit use isprint */ -#endif rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; rl_completion_entry_function= &no_completion; rl_add_defun("magic-space", (Function*)&fake_magic_space, -1); -- cgit v1.2.1