[sr-dev] git:master:6a36cc88: core: move PKG*, SYS* and SHM* macros to the new memory manager headers

Henning Westerholt hw at kamailio.org
Fri Dec 28 18:24:45 CET 2018


Module: kamailio
Branch: master
Commit: 6a36cc88ce63d8a3eedd4a9e5a4bbf1e75f57934
URL: https://github.com/kamailio/kamailio/commit/6a36cc88ce63d8a3eedd4a9e5a4bbf1e75f57934

Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2018-12-28T17:37:37+01:00

core: move PKG*, SYS* and SHM* macros to the new memory manager headers

---

Modified: src/core/mem/mem.h
Modified: src/core/mem/pkg.h
Modified: src/core/mem/shm.h

---

Diff:  https://github.com/kamailio/kamailio/commit/6a36cc88ce63d8a3eedd4a9e5a4bbf1e75f57934.diff
Patch: https://github.com/kamailio/kamailio/commit/6a36cc88ce63d8a3eedd4a9e5a4bbf1e75f57934.patch

---

diff --git a/src/core/mem/mem.h b/src/core/mem/mem.h
index c11f891118..23aa981483 100644
--- a/src/core/mem/mem.h
+++ b/src/core/mem/mem.h
@@ -42,22 +42,5 @@
 
 #include "pkg.h"
 
-
-/** generic logging helper for allocation errors in private memory pool/ system */
-#ifdef SYS_MALLOC
-#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from sys pool\n")
-#define PKG_MEM_CRITICAL LM_CRIT("could not allocate private memory from sys pool\n")
-#else
-#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from pkg pool\n")
-#define PKG_MEM_CRITICAL LM_CRIT("could not allocate private memory from pkg pool\n")
 #endif
 
-/** generic logging helper for allocation errors in system memory */
-#define SYS_MEM_ERROR LM_ERR("could not allocate memory from system\n")
-#define SYS_MEM_CRITICAL LM_CRIT("could not allocate memory from system\n")
-
-/** generic logging helper for allocation errors in shared memory pool */
-#define SHM_MEM_ERROR LM_ERR("could not allocate shared memory from shm pool\n")
-#define SHM_MEM_CRITICAL LM_CRIT("could not allocate shared memory from shm pool\n")
-
-#endif
diff --git a/src/core/mem/pkg.h b/src/core/mem/pkg.h
index 7b57719e46..0222baffe0 100644
--- a/src/core/mem/pkg.h
+++ b/src/core/mem/pkg.h
@@ -111,4 +111,17 @@ void pkg_print_manager(void);
 #	define pkg_mod_free_stats(x)    do{}while(0)
 #endif /*PKG_MALLOC*/
 
+/** generic logging helper for allocation errors in private memory pool/ system */
+#ifdef SYS_MALLOC
+#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from sys pool\n")
+#define PKG_MEM_CRITICAL LM_CRIT("could not allocate private memory from sys pool\n")
+#else
+#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from pkg pool\n")
+#define PKG_MEM_CRITICAL LM_CRIT("could not allocate private memory from pkg pool\n")
+#endif
+
+/** generic logging helper for allocation errors in system memory */
+#define SYS_MEM_ERROR LM_ERR("could not allocate memory from system\n")
+#define SYS_MEM_CRITICAL LM_CRIT("could not allocate memory from system\n")
+
 #endif
diff --git a/src/core/mem/shm.h b/src/core/mem/shm.h
index 4143462617..a726eefdb0 100644
--- a/src/core/mem/shm.h
+++ b/src/core/mem/shm.h
@@ -96,4 +96,8 @@ int shm_address_in(void *p);
 #define shm_available_safe() shm_available()
 #define shm_malloc_on_fork() do{}while(0)
 
+/** generic logging helper for allocation errors in shared memory pool */
+#define SHM_MEM_ERROR LM_ERR("could not allocate shared memory from shm pool\n")
+#define SHM_MEM_CRITICAL LM_CRIT("could not allocate shared memory from shm pool\n")
+
 #endif




More information about the sr-dev mailing list