projects
/
libusual.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4faf71f
)
cxalloc: make cx=NULL mean USUAL_ALLOC
author
Marko Kreen
<
[email protected]
>
Tue, 27 May 2014 22:05:58 +0000
(
01:05
+0300)
committer
Marko Kreen
<
[email protected]
>
Thu, 12 Jun 2014 18:47:51 +0000
(21:47 +0300)
usual/cxalloc.c
patch
|
blob
|
blame
|
history
diff --git
a/usual/cxalloc.c
b/usual/cxalloc.c
index 3651fa15794135aba732f776286534dd54b0cbc9..bc65f8eb33aae86c78f68fec6261e151cdf52d7f 100644
(file)
--- a/
usual/cxalloc.c
+++ b/
usual/cxalloc.c
@@
-29,11
+29,15
@@
void *cx_alloc(CxMem *cx, size_t len)
{
if (!len)
return NULL;
+ if (!cx)
+ cx = USUAL_ALLOC;
return cx->ops->c_alloc(cx->ctx, len);
}
void *cx_realloc(CxMem *cx, void *ptr, size_t len)
{
+ if (!cx)
+ cx = USUAL_ALLOC;
if (!ptr)
return cx_alloc(cx, len);
if (!len) {
@@
-45,6
+49,8
@@
void *cx_realloc(CxMem *cx, void *ptr, size_t len)
void cx_free(CxMem *cx, const void *ptr)
{
+ if (!cx)
+ cx = USUAL_ALLOC;
if (ptr)
cx->ops->c_free(cx->ctx, ptr);
}