From af214790e552310a254ee212df29e8d83f0427a1 Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 7 Mar 2013 15:12:57 +0100 Subject: fix a couple of compilation errors and warnings * fix compilation via cmake * fix minor compiler warnings * add --enable-fast-mutexes to compile with fast mutexes support. the plugin will crash if server and plugin do not match! --- configure.ac | 40 ++++++++++++++++++++++++++++------------ src/mysql_inc.h | 3 +++ src/table_sizes.cc | 14 ++++++++------ 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 7e6764d..86fda3a 100644 --- a/configure.ac +++ b/configure.ac @@ -11,26 +11,42 @@ AC_CONFIG_SRCDIR([src/table_sizes.cc]) AC_CONFIG_HEADER([src/config.h]) AC_DEFUN([CHECK_DEBUG], [ - debug_default="no" - AC_ARG_ENABLE(debug, [ --enable-debug=[no/yes] turn on debugging - [default=no]],, enable_debug=$debug_default) + AC_ARG_ENABLE([debug], + AS_HELP_STRING([--enable-debug], [turn on debugging, default: no])) + AC_MSG_CHECKING(whether to enable debugging) + AS_IF([test "x$enable_debug" = "xyes"], + [ + CPPFLAGS="$CPPFLAGS -g -D_DEBUG" + AC_MSG_RESULT(yes) + ], + [ + CPPFLAGS="$CPPFLAGS -g -O2 -DDBUG_OFF" + AC_MSG_RESULT(no) + ] + ) +]) - if test "x$enable_debug" = "xyes" - then - CPPFLAGS="$CPPFLAGS -g -D_DEBUG" - AC_MSG_RESULT(yes) - else - CPPFLAGS="$CPPFLAGS -g -O2 -DDBUG_OFF" - AC_MSG_RESULT(no) - fi +AC_DEFUN([CHECK_FAST_MUTEXES], [ + AC_ARG_ENABLE([fast-mutexes], + AS_HELP_STRING([--enable-fast-mutexes], [compile with fast mutexes, default: no])) + + AC_MSG_CHECKING(whether to compile with fast mutexes) + AS_IF([test "x$enable_fast_mutexes" = "xyes"], + [ + CPPFLAGS="$CPPFLAGS -DMY_PTHREAD_FASTMUTEX=1" + AC_MSG_RESULT(yes) + ], + [ AC_MSG_RESULT(no) ] + ) ]) + dnl Run tests using C++ compiler dnl AC_LANG(C++) -#check debug CHECK_DEBUG +CHECK_FAST_MUTEXES #check for mysql src MYSQL_SRC_TEST diff --git a/src/mysql_inc.h b/src/mysql_inc.h index ca055ca..4912682 100644 --- a/src/mysql_inc.h +++ b/src/mysql_inc.h @@ -5,7 +5,10 @@ #define HAVE_CONFIG_H #endif +#ifndef MYSQL_DYNAMIC_PLUGIN #define MYSQL_DYNAMIC_PLUGIN +#endif + #define MYSQL_SERVER 1 #include diff --git a/src/table_sizes.cc b/src/table_sizes.cc index b1fd8b0..bfa0106 100644 --- a/src/table_sizes.cc +++ b/src/table_sizes.cc @@ -13,10 +13,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "mysql_inc.h" -#include -#include -#include -#include +#include +#include +#include +#include #define STR_OR_NIL(S) ((S) ? (S) : "") @@ -292,13 +292,15 @@ static int fill_table(THD *thd, TABLE_LIST *tables, COND *cond) goto err; LEX_STRING *db_name; - while (db_name = it++) + while ((db_name = it++)) { +#ifndef NO_EMBEDDED_ACCESS_CHECKS if ((check_access(thd, SELECT_ACL, db_name->str, &thd->col_access, NULL, 0, 1) || (!thd->col_access && check_grant_db(thd, db_name->str))) && !sctx->master_access & (DB_ACLS | SHOW_DB_ACL) && !acl_get(sctx->host, sctx->ip, sctx->priv_user, db_name->str, 0)) continue; +#endif List tables; int res = make_table_list(thd, &tables, lex, db_name); @@ -312,7 +314,7 @@ static int fill_table(THD *thd, TABLE_LIST *tables, COND *cond) TABLE_DATA *table_data; List_iterator_fast it_tables(tables); - while (table_data = it_tables++) + while ((table_data = it_tables++)) { table->field[0]->store(db_name->str, db_name->length, system_charset_info); -- cgit v1.2.3