From 99677cc510df14440958a784195679eedb5788a2 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 28 Aug 2014 20:07:27 +0200 Subject: [PATCH] cleanup: move safe_str*() from sql_acl.cc to m_string.h --- include/m_string.h | 11 +++++++++++ include/maria.h | 7 ++++--- sql/sql_acl.cc | 11 ----------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/m_string.h b/include/m_string.h index 395fd2ddda6..0a46805bfae 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -239,4 +239,15 @@ static inline void lex_string_set(LEX_STRING *lex_str, const char *c_str) lex_str->length= strlen(c_str); } +#ifdef __cplusplus +static inline char *safe_str(char *str) +{ return str ? str : const_cast(""); } +#endif + +static inline const char *safe_str(const char *str) +{ return str ? str : ""; } + +static inline size_t safe_strlen(const char *str) +{ return str ? strlen(str) : 0; } + #endif diff --git a/include/maria.h b/include/maria.h index 908825b9970..b35dc7dd3f0 100644 --- a/include/maria.h +++ b/include/maria.h @@ -19,9 +19,6 @@ #ifndef _maria_h #define _maria_h -#ifdef __cplusplus -extern "C" { -#endif #include #include #include @@ -30,6 +27,10 @@ extern "C" { #include #include +#ifdef __cplusplus +extern "C" { +#endif + #define MARIA_CANNOT_ROLLBACK /* diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index b922eead8ea..1b995fd648d 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -205,17 +205,6 @@ static plugin_ref old_password_plugin; #endif static plugin_ref native_password_plugin; -static char *safe_str(char *str) -{ return str ? str : const_cast(""); } - -static const char *safe_str(const char *str) -{ return str ? str : ""; } - -#ifndef NO_EMBEDDED_ACCESS_CHECKS -static size_t safe_strlen(const char *str) -{ return str ? strlen(str) : 0; } -#endif - /* Classes */ struct acl_host_and_ip