[Asterisk-code-review] core: Fix unused variable error in handle show sysinfo. (asterisk[13])

Alexander Traud asteriskteam at digium.com
Sat Jan 27 10:12:06 CST 2018


Alexander Traud has uploaded this change for review. ( https://gerrit.asterisk.org/8071


Change subject: core: Fix unused variable error in handle_show_sysinfo.
......................................................................

core: Fix unused variable error in handle_show_sysinfo.

The previous fix broke the case
HAVE_SYSINFO = no
HAVE_SYSCTL = yes
HAVE_SWAPCTL = no
which occurs on FreeBSD 11.1 for example.

ASTERISK-26563

Change-Id: If77c39bc75f0b83a6c8a24ecb2fa69be8846160a
---
M main/asterisk.c
1 file changed, 7 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/71/8071/1

diff --git a/main/asterisk.c b/main/asterisk.c
index 01107e2..d2230dc 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -782,12 +782,6 @@
 	ast_free(swdev);
 	return 1;
 }
-#elif defined(HAVE_SYSCTL) && !defined(HAVE_SYSINFO)
-static int swapmode(int *used, int *total)
-{
-	*used = *total = 0;
-	return 1;
-}
 #endif
 
 #if defined(HAVE_SYSINFO) || defined(HAVE_SYSCTL)
@@ -796,11 +790,11 @@
 {
 	uint64_t physmem, freeram;
 #if defined(HAVE_SYSINFO) || defined(HAVE_SWAPCTL)
+	int totalswap = 0;
 	uint64_t freeswap = 0;
 #endif
 	int nprocs = 0;
 	long uptime = 0;
-	int totalswap = 0;
 #if defined(HAVE_SYSINFO)
 	struct sysinfo sys_info;
 #elif defined(HAVE_SYSCTL)
@@ -808,7 +802,10 @@
 	struct vmtotal vmtotal;
 	struct timeval	boottime;
 	time_t	now;
-	int mib[2], pagesize, usedswap = 0;
+	int mib[2], pagesize;
+#if defined(HAVE_SWAPCTL)
+	int usedswap = 0;
+#endif
 	size_t len;
 #endif
 
@@ -868,8 +865,10 @@
 	sysctl(mib, 2, &vmtotal, &len, NULL, 0);
 	freeram = (vmtotal.t_free << pageshift);
 	/* generate swap usage and totals */
+#if defined(HAVE_SWAPCTL)
 	swapmode(&usedswap, &totalswap);
 	freeswap = (totalswap - usedswap);
+#endif
 	/* grab number of processes */
 #if defined(__OpenBSD__)
 	mib[0] = CTL_KERN;

-- 
To view, visit https://gerrit.asterisk.org/8071
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: If77c39bc75f0b83a6c8a24ecb2fa69be8846160a
Gerrit-Change-Number: 8071
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180127/5aff6e83/attachment.html>


More information about the asterisk-code-review mailing list