projects
/
profile
/
ivi
/
murphy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
891b87b
)
common: added mrp_datadup.
author
Krisztian Litkey
<kli@iki.fi>
Wed, 25 Apr 2012 23:24:24 +0000
(
02:24
+0300)
committer
Krisztian Litkey
<krisztian.litkey@intel.com>
Wed, 2 May 2012 15:52:01 +0000
(18:52 +0300)
src/common/mm.h
patch
|
blob
|
history
diff --git
a/src/common/mm.h
b/src/common/mm.h
index
27bf9e8
..
9b62258
100644
(file)
--- a/
src/common/mm.h
+++ b/
src/common/mm.h
@@
-18,6
+18,14
@@
MRP_CDECL_BEGIN
#define mrp_realloc(ptr, size) mrp_mm_realloc((ptr), (size), __LOC__)
#define mrp_free(ptr) mrp_mm_free((ptr), __LOC__)
#define mrp_strdup(s) mrp_mm_strdup((s), __LOC__)
+#define mrp_datadup(ptr, size) ({ \
+ typeof(ptr) _ptr = mrp_alloc(size); \
+ \
+ if (_ptr != NULL) \
+ memcpy(_ptr, ptr, size); \
+ \
+ _ptr; \
+ })
#define mrp_allocz(size) ({ \
void *_ptr; \