diff options
author | Sergei Golubchik <serg@mariadb.org> | 2014-08-28 20:07:27 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2014-10-10 22:27:41 +0200 |
commit | 99677cc510df14440958a784195679eedb5788a2 (patch) | |
tree | 2af4f66dd99202d46b218ff63c30642458abdadb /include/m_string.h | |
parent | 9bd5d54c112c706c4ddd80356444a084dc623225 (diff) | |
download | mariadb-git-99677cc510df14440958a784195679eedb5788a2.tar.gz |
cleanup: move safe_str*() from sql_acl.cc to m_string.h
Diffstat (limited to 'include/m_string.h')
-rw-r--r-- | include/m_string.h | 11 |
1 files changed, 11 insertions, 0 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<char*>(""); } +#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 |