Module: kamailio
Branch: master
Commit: 54c18ebb4b471af95aa403a81d4a37b71c9c4a14
URL:
https://github.com/kamailio/kamailio/commit/54c18ebb4b471af95aa403a81d4a37b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-10-11T13:11:04+02:00
core: mem/shm - wrapper marcro to check if xsetfunc is implemented
---
Modified: src/core/mem/shm.h
---
Diff:
https://github.com/kamailio/kamailio/commit/54c18ebb4b471af95aa403a81d4a37b…
Patch:
https://github.com/kamailio/kamailio/commit/54c18ebb4b471af95aa403a81d4a37b…
---
diff --git a/src/core/mem/shm.h b/src/core/mem/shm.h
index 9ea31d53131..8d4d0d95eed 100644
--- a/src/core/mem/shm.h
+++ b/src/core/mem/shm.h
@@ -105,7 +105,14 @@ extern sr_shm_api_t _shm_root;
#define shm_global_lock() _shm_root.xglock(_shm_root.mem_block)
#define shm_global_unlock() _shm_root.xgunlock(_shm_root.mem_block)
-#define shm_setfunc(p, f) _shm_root.xsetfunc(_shm_root.mem_block, (p), (f))
+#define shm_setfunc(p, f) \
+ do { \
+ if(_shm_root.xsetfunc) { \
+ _shm_root.xsetfunc(_shm_root.mem_block, (p), (f)); \
+ } else { \
+ LM_ERR("xsetfunc not implemented\n"); \
+ } \
+ } while(0)
void *shm_core_get_pool(void);
int shm_init_api(sr_shm_api_t *ap);