summaryrefslogtreecommitdiff
path: root/mysys/my_alloc.c
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-10-12 19:24:28 +0200
committerSergei Golubchik <serg@mariadb.org>2018-10-31 16:06:16 +0100
commitca7401afdf279b99a8f6c08a332096dabd3e4c52 (patch)
tree137b8bcc62b52e7616630f89249e21b5477addd1 /mysys/my_alloc.c
parentdfbba3d20220e5c9219b4b879e2d99999d53c05d (diff)
downloadmariadb-git-ca7401afdf279b99a8f6c08a332096dabd3e4c52.tar.gz
cleanup: safe_lexcstrdup_root()
Diffstat (limited to 'mysys/my_alloc.c')
-rw-r--r--mysys/my_alloc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c
index abcc692211a..576142343f4 100644
--- a/mysys/my_alloc.c
+++ b/mysys/my_alloc.c
@@ -492,3 +492,14 @@ void *memdup_root(MEM_ROOT *root, const void *str, size_t len)
memcpy(pos,str,len);
return pos;
}
+
+LEX_CSTRING safe_lexcstrdup_root(MEM_ROOT *root, const LEX_CSTRING str)
+{
+ LEX_CSTRING res;
+ if (str.length)
+ res.str= strmake_root(root, str.str, str.length);
+ else
+ res.str= (const char *)"";
+ res.length= str.length;
+ return res;
+}