[sr-dev] git:master:27d71da5: core: mem - renamed memory info fields

Daniel-Constantin Mierla miconda at gmail.com
Fri Mar 4 09:45:14 CET 2022


Module: kamailio
Branch: master
Commit: 27d71da5da8a2f33a74e35765ba00ef83a20186f
URL: https://github.com/kamailio/kamailio/commit/27d71da5da8a2f33a74e35765ba00ef83a20186f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-03-04T09:26:07+01:00

core: mem - renamed memory info fields

- avoid conflict with keywords like free

---

Modified: src/core/core_cmd.c
Modified: src/core/mem/f_malloc.c
Modified: src/core/mem/meminfo.h
Modified: src/core/mem/q_malloc.c
Modified: src/core/mem/tlsf_malloc.c

---

Diff:  https://github.com/kamailio/kamailio/commit/27d71da5da8a2f33a74e35765ba00ef83a20186f.diff
Patch: https://github.com/kamailio/kamailio/commit/27d71da5da8a2f33a74e35765ba00ef83a20186f.patch

---

diff --git a/src/core/core_cmd.c b/src/core/core_cmd.c
index d045a144cb..c464d3686e 100644
--- a/src/core/core_cmd.c
+++ b/src/core/core_cmd.c
@@ -598,8 +598,8 @@ static void core_shmmem(rpc_t* rpc, void* c)
 	rpc->add(c, "{", &handle);
 	rpc->struct_add(handle, "dddddd",
 		"total", (unsigned int)(mi.total_size>>rs),
-		"free", (unsigned int)(mi.free>>rs),
-		"used", (unsigned int)(mi.used>>rs),
+		"free", (unsigned int)(mi.free_size>>rs),
+		"used", (unsigned int)(mi.used_size>>rs),
 		"real_used",(unsigned int)(mi.real_used>>rs),
 		"max_used", (unsigned int)(mi.max_used>>rs),
 		"fragments", (unsigned int)mi.total_frags
diff --git a/src/core/mem/f_malloc.c b/src/core/mem/f_malloc.c
index 38f686ff2c..6cb98addc1 100644
--- a/src/core/mem/f_malloc.c
+++ b/src/core/mem/f_malloc.c
@@ -951,8 +951,8 @@ void fm_info(void* qmp, struct mem_info* info)
 	memset(info,0, sizeof(*info));
 	info->total_size=qm->size;
 	info->min_frag=MIN_FRAG_SIZE;
-	info->free=qm->size-qm->real_used;
-	info->used=qm->used;
+	info->free_size=qm->size-qm->real_used;
+	info->used_size=qm->used;
 	info->real_used=qm->real_used;
 	info->max_used=qm->max_real_used;
 	info->total_frags=qm->ffrags;
diff --git a/src/core/mem/meminfo.h b/src/core/mem/meminfo.h
index 8b69daa705..9a823c49fe 100644
--- a/src/core/mem/meminfo.h
+++ b/src/core/mem/meminfo.h
@@ -19,7 +19,7 @@
 /**
  * \file
  * \brief Memory manager (malloc) informations and statistics
- * 
+ *
  * Memory manager (malloc) informations and statistics, like the used memory,
  * fragmentations etc..
  * \ingroup mem
@@ -34,8 +34,8 @@
 /** Memory information structure */
 struct mem_info{
 	unsigned long total_size; /** total size of memory pool */
-	unsigned long free; /** free memory */
-	unsigned long used; /** allocated size */
+	unsigned long free_size; /** free memory */
+	unsigned long used_size; /** allocated size */
 	unsigned long real_used; /** used size plus overhead from malloc */
 	unsigned long max_used; /** maximum used size since server start? */
 	unsigned long min_frag; /** minimum number of fragmentations? */
diff --git a/src/core/mem/q_malloc.c b/src/core/mem/q_malloc.c
index fb786ba635..403ee34da8 100644
--- a/src/core/mem/q_malloc.c
+++ b/src/core/mem/q_malloc.c
@@ -942,8 +942,8 @@ void qm_info(void* qmp, struct mem_info* info)
 	memset(info,0, sizeof(*info));
 	info->total_size=qm->size;
 	info->min_frag=MIN_FRAG_SIZE;
-	info->free=qm->size-qm->real_used;
-	info->used=qm->used;
+	info->free_size=qm->size-qm->real_used;
+	info->used_size=qm->used;
 	info->real_used=qm->real_used;
 	info->max_used=qm->max_real_used;
 	info->total_frags=qm->ffrags;
diff --git a/src/core/mem/tlsf_malloc.c b/src/core/mem/tlsf_malloc.c
index 10db30264b..19b71a8be3 100644
--- a/src/core/mem/tlsf_malloc.c
+++ b/src/core/mem/tlsf_malloc.c
@@ -1178,11 +1178,11 @@ void tlsf_meminfo(tlsf_t pool, struct mem_info *info)
 {
 	control_t* control = tlsf_cast(control_t*, pool);
 	memset(info, 0, sizeof(*info));
-	info->free = control->total_size - control->real_used;
+	info->free_size = control->total_size - control->real_used;
 	info->max_used = control->max_used;
 	info->real_used = control->real_used;
 	info->total_frags = control->fragments;
-	info->used = control->allocated;
+	info->used_size = control->allocated;
 	info->total_size = control->total_size;
 }
 




More information about the sr-dev mailing list