From 8b637b284784d92b912318cd3b52d1550920fa09 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Fri, 22 Aug 2008 12:40:21 +0200 Subject: [PATCH] Fixning compiler warnings. Fixing build failure for valgrind platform. include/my_global.h: Moving YESNO() macro here from log.cc (it prints either "yes" or "no" depending on a boolean value). sql/log.cc: Moving YESNO() function to my_global.h. sql/sql_class.cc: Adding default case to printout function to avoid warning. Only defining function for debug builds since it isn't used in non-debug build (hence produce a warning). sql/sql_class.h: Printing yes/no answer instead of memory address since the case produces an error/warning on valgrind platform. --- include/my_global.h | 3 +++ sql/log.cc | 2 -- sql/sql_class.cc | 10 ++++++---- sql/sql_class.h | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index 6cfc4d67305..c6ac90d4a34 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1130,6 +1130,9 @@ typedef char bool; /* Ordinary boolean values 0 1 */ #define dbug_volatile #endif +/* Some helper macros */ +#define YESNO(X) ((X) ? "yes" : "no") + /* Defines for time function */ #define SCALE_SEC 100 #define SCALE_USEC 10000 diff --git a/sql/log.cc b/sql/log.cc index a6f3192b061..49c9bce95f1 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1448,8 +1448,6 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all) return 0; } -#define YESNO(X) ((X) ? "yes" : "no") - /** This function is called once after each statement. diff --git a/sql/sql_class.cc b/sql/sql_class.cc index b6070c61974..50888c6f7af 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3528,22 +3528,24 @@ int THD::binlog_flush_pending_rows_event(bool stmt_end) } +#ifndef DBUG_OFF static const char * show_query_type(THD::enum_binlog_query_type qtype) { switch (qtype) { + static char buf[64]; case THD::ROW_QUERY_TYPE: return "ROW"; case THD::STMT_QUERY_TYPE: return "STMT"; case THD::MYSQL_QUERY_TYPE: return "MYSQL"; + default: + sprintf(buf, "UNKNOWN#%d", qtype); + return buf; } - - static char buf[64]; - sprintf(buf, "UNKNOWN#%d", qtype); - return buf; } +#endif /* diff --git a/sql/sql_class.h b/sql/sql_class.h index 7381930dc93..0bc8d00b22c 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2100,8 +2100,8 @@ public: Don't reset binlog format for NDB binlog injector thread. */ DBUG_PRINT("debug", - ("temporary_tables: %d, in_sub_stmt: %d, system_thread: %s", - (int) temporary_tables, in_sub_stmt, + ("temporary_tables: %s, in_sub_stmt: %s, system_thread: %s", + YESNO(temporary_tables), YESNO(in_sub_stmt), show_system_thread(system_thread))); if ((temporary_tables == NULL) && (in_sub_stmt == 0) && (system_thread != SYSTEM_THREAD_NDBCLUSTER_BINLOG))