mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#45288: pb2 returns a lot of compilation warnings on linux
Fix warnings flagged by the new warning option -Wunused-but-set-variable that was added to GCC 4.6 and that is enabled by -Wunused and -Wall. The option causes a warning whenever a local variable is assigned to but is later unused. It also warns about meaningless pointer dereferences. client/mysql.cc: Meaningless pointer dereferences. client/mysql_upgrade.c: Check whether reading from the file succeeded. extra/comp_err.c: Unused. extra/yassl/src/yassl_imp.cpp: Skip instead of reading data that is discarded. include/my_pthread.h: Variable is only used in debug builds. include/mysys_err.h: Add new error messages. mysys/errors.c: Add new error message for permission related functions. mysys/mf_iocache.c: Variable is only checked under THREAD. mysys/my_copy.c: Raise a error if chmod or chown fails. mysys/my_redel.c: Raise a error if chmod or chown fails. regex/engine.c: Use a equivalent variable for the assert. server-tools/instance-manager/instance_options.cc: Unused. sql/field.cc: Unused. sql/item.cc: Unused. sql/log.cc: Do not ignore the return value of freopen: only set buffer if reopening succeeds. Adjust doxygen comment to the right function. Pass message lenght to log function. sql/mysqld.cc: Do not ignore the return value of freopen: only set buffer if reopening succeeds. sql/partition_info.cc: Unused. sql/slave.cc: No need to set pointer to the address of '\0'. sql/spatial.cc: Unused. Left for historical purposes. sql/sql_acl.cc: Unused. sql/sql_base.cc: Pointers are always set to the same variables. sql/sql_parse.cc: End statement if reading fails. Store the buffer after it has actually been updated. sql/sql_repl.cc: No need to set pointer to the address of '\0'. sql/sql_show.cc: Put variable under the same ifdef block. sql/udf_example.c: Set null pointer flag appropriately. storage/csv/ha_tina.cc: Meaningless dereferences. storage/example/ha_example.cc: Return the error since it's available. storage/myisam/mi_locking.c: Remove unused and dead code.
This commit is contained in:
@ -465,6 +465,12 @@ static void handle_bootstrap_impl(THD *thd)
|
||||
}
|
||||
buff= (char*) thd->net.buff;
|
||||
res= fgets(buff + length, thd->net.max_packet - length, file);
|
||||
if (!res && !feof(file))
|
||||
{
|
||||
net_end_statement(thd);
|
||||
bootstrap_error= 1;
|
||||
break;
|
||||
}
|
||||
length+= (ulong) strlen(buff + length);
|
||||
/* purecov: end */
|
||||
}
|
||||
@ -1535,7 +1541,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
{
|
||||
STATUS_VAR current_global_status_var;
|
||||
ulong uptime;
|
||||
uint length;
|
||||
uint length __attribute__((unused));
|
||||
ulonglong queries_per_second1000;
|
||||
char buff[250];
|
||||
uint buff_len= sizeof(buff);
|
||||
@ -1548,7 +1554,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
else
|
||||
queries_per_second1000= thd->query_id * LL(1000) / uptime;
|
||||
|
||||
length= my_snprintf((char*) buff, buff_len - 1,
|
||||
length= my_snprintf(buff, buff_len - 1,
|
||||
"Uptime: %lu Threads: %d Questions: %lu "
|
||||
"Slow queries: %lu Opens: %lu Flush tables: %lu "
|
||||
"Open tables: %u Queries per second avg: %u.%u",
|
||||
@ -1560,10 +1566,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
cached_open_tables(),
|
||||
(uint) (queries_per_second1000 / 1000),
|
||||
(uint) (queries_per_second1000 % 1000));
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
/* Store the buffer in permanent memory */
|
||||
my_ok(thd, 0, 0, buff);
|
||||
#endif
|
||||
#ifdef SAFEMALLOC
|
||||
if (sf_malloc_cur_memory) // Using SAFEMALLOC
|
||||
{
|
||||
@ -1578,6 +1580,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
VOID(my_net_write(net, (uchar*) buff, length));
|
||||
VOID(net_flush(net));
|
||||
thd->main_da.disable_status();
|
||||
#else
|
||||
/* Store the buffer in permanent memory */
|
||||
my_ok(thd, 0, 0, buff);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user