Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e83b1a8b
Commit
e83b1a8b
authored
Apr 17, 2006
by
osku
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mem_heap_strcat().
parent
f1529a9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
include/mem0mem.h
include/mem0mem.h
+11
-0
mem/mem0mem.c
mem/mem0mem.c
+25
-0
No files found.
include/mem0mem.h
View file @
e83b1a8b
...
...
@@ -311,6 +311,17 @@ mem_heap_strdupl(
const
char
*
str
,
/* in: string to be copied */
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
/**********************************************************************
Goes through the list of all allocated mem blocks, checks their magic
...
...
mem/mem0mem.c
View file @
e83b1a8b
...
...
@@ -114,6 +114,31 @@ mem_heap_strdup(
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. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment