summaryrefslogtreecommitdiff
path: root/mysys/my_malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mysys/my_malloc.c')
-rw-r--r--mysys/my_malloc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index 1e7cdd3a3b5..fc2f22b079a 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -81,3 +81,15 @@ my_string my_strdup(const char *from, myf MyFlags)
memcpy((byte*) ptr, (byte*) from,(size_t) length);
return((my_string) ptr);
}
+
+
+gptr my_strdup_with_length(const byte *from, uint length, myf MyFlags)
+{
+ gptr ptr;
+ if ((ptr=my_malloc(length+1,MyFlags)) != 0)
+ {
+ memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ ptr[length]=0;
+ }
+ return(ptr);
+}