Commit e83b1a8b authored by osku's avatar osku

Add mem_heap_strcat().

parent f1529a9c
...@@ -311,6 +311,17 @@ mem_heap_strdupl( ...@@ -311,6 +311,17 @@ mem_heap_strdupl(
const char* str, /* in: string to be copied */ const char* str, /* in: string to be copied */
ulint len); /* in: length of str, in bytes */ ulint len); /* in: length of str, in bytes */
/**************************************************************************
Concatenate two strings and return the result, using a memory heap. */
char*
mem_heap_strcat(
/*============*/
/* out, own: the result */
mem_heap_t* heap, /* in: memory heap where string is allocated */
const char* s1, /* in: string 1 */
const char* s2); /* in: string 2 */
#ifdef MEM_PERIODIC_CHECK #ifdef MEM_PERIODIC_CHECK
/********************************************************************** /**********************************************************************
Goes through the list of all allocated mem blocks, checks their magic Goes through the list of all allocated mem blocks, checks their magic
......
...@@ -114,6 +114,31 @@ mem_heap_strdup( ...@@ -114,6 +114,31 @@ mem_heap_strdup(
return(memcpy(mem_heap_alloc(heap, len), str, len)); return(memcpy(mem_heap_alloc(heap, len), str, len));
} }
/**************************************************************************
Concatenate two strings and return the result, using a memory heap. */
char*
mem_heap_strcat(
/*============*/
/* out, own: the result */
mem_heap_t* heap, /* in: memory heap where string is allocated */
const char* s1, /* in: string 1 */
const char* s2) /* in: string 2 */
{
char* s;
ulint s1_len = strlen(s1);
ulint s2_len = strlen(s2);
s = mem_heap_alloc(heap, s1_len + s2_len + 1);
memcpy(s, s1, s1_len);
memcpy(s + s1_len, s2, s2_len);
s[s1_len + s2_len] = '\0';
return(s);
}
/******************************************************************* /*******************************************************************
Creates a memory heap block where data can be allocated. */ Creates a memory heap block where data can be allocated. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment