summaryrefslogtreecommitdiff
path: root/include/m_string.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/m_string.h')
-rw-r--r--include/m_string.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/include/m_string.h b/include/m_string.h
index 188802bc08b..d088b510de5 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -64,20 +64,13 @@
extern "C" {
#endif
-/*
- my_str_malloc(), my_str_realloc() and my_str_free() are assigned to
- implementations in strings/alloc.c, but can be overridden in
- the calling program.
- */
-extern void *(*my_str_malloc)(size_t);
-extern void *(*my_str_realloc)(void *, size_t);
-extern void (*my_str_free)(void *);
-
+#ifdef DBUG_OFF
#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER)
#define strmov(A,B) __builtin_stpcpy((A),(B))
#elif defined(HAVE_STPCPY)
#define strmov(A,B) stpcpy((A),(B))
#endif
+#endif
/* Declared in int2str() */
extern const char _dig_vec_upper[];
@@ -231,4 +224,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