[Asterisk-code-review] CLI: Cosmetic issue - core show uptime (asterisk[master])

ibercom asteriskteam at digium.com
Fri Jun 5 02:17:59 CDT 2015


ibercom has uploaded a new change for review.

  https://gerrit.asterisk.org/594

Change subject: CLI: Cosmetic issue - core show uptime
......................................................................

CLI: Cosmetic issue - core show uptime

Show uptime information ends with an unnecessary space.

Now NEEDCOMMA is better defined.

Change-Id: I11b360504a0703309ff51772ff8f672287f3c5a1
---
M main/cli.c
1 file changed, 10 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/94/594/1

diff --git a/main/cli.c b/main/cli.c
index eb8800f..e59a856 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -802,7 +802,7 @@
 #define DAY (HOUR*24)
 #define WEEK (DAY*7)
 #define YEAR (DAY*365)
-#define NEEDCOMMA(x) ((x)? ",": "")	/* define if we need a comma */
+#define NEEDCOMMA(x) ((x) ? ", " : "")	/* define if we need a comma */
 	if (timeval.tv_sec < 0)	/* invalid, nothing to show */
 		return;
 
@@ -814,31 +814,33 @@
 	if (timeval.tv_sec > YEAR) {
 		x = (timeval.tv_sec / YEAR);
 		timeval.tv_sec -= (x * YEAR);
-		ast_str_append(&out, 0, "%d year%s%s ", x, ESS(x),NEEDCOMMA(timeval.tv_sec));
+		ast_str_append(&out, 0, "%d year%s%s", x, ESS(x), NEEDCOMMA(timeval.tv_sec));
 	}
 	if (timeval.tv_sec > WEEK) {
 		x = (timeval.tv_sec / WEEK);
 		timeval.tv_sec -= (x * WEEK);
-		ast_str_append(&out, 0, "%d week%s%s ", x, ESS(x),NEEDCOMMA(timeval.tv_sec));
+		ast_str_append(&out, 0, "%d week%s%s", x, ESS(x), NEEDCOMMA(timeval.tv_sec));
 	}
 	if (timeval.tv_sec > DAY) {
 		x = (timeval.tv_sec / DAY);
 		timeval.tv_sec -= (x * DAY);
-		ast_str_append(&out, 0, "%d day%s%s ", x, ESS(x),NEEDCOMMA(timeval.tv_sec));
+		ast_str_append(&out, 0, "%d day%s%s", x, ESS(x), NEEDCOMMA(timeval.tv_sec));
 	}
 	if (timeval.tv_sec > HOUR) {
 		x = (timeval.tv_sec / HOUR);
 		timeval.tv_sec -= (x * HOUR);
-		ast_str_append(&out, 0, "%d hour%s%s ", x, ESS(x),NEEDCOMMA(timeval.tv_sec));
+		ast_str_append(&out, 0, "%d hour%s%s", x, ESS(x), NEEDCOMMA(timeval.tv_sec));
 	}
 	if (timeval.tv_sec > MINUTE) {
 		x = (timeval.tv_sec / MINUTE);
 		timeval.tv_sec -= (x * MINUTE);
-		ast_str_append(&out, 0, "%d minute%s%s ", x, ESS(x),NEEDCOMMA(timeval.tv_sec));
+		ast_str_append(&out, 0, "%d minute%s%s", x, ESS(x), NEEDCOMMA(timeval.tv_sec));
 	}
 	x = timeval.tv_sec;
-	if (x > 0 || ast_str_strlen(out) == 0)	/* if there is nothing, print 0 seconds */
-		ast_str_append(&out, 0, "%d second%s ", x, ESS(x));
+	if (x > 0 || ast_str_strlen(out) == 0) {
+		/* if there is nothing, print 0 seconds */
+		ast_str_append(&out, 0, "%d second%s", x, ESS(x));
+	}
 	ast_cli(fd, "%s: %s\n", prefix, ast_str_buffer(out));
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11b360504a0703309ff51772ff8f672287f3c5a1
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: ibercom <ibercom123 at gmail.com>



More information about the asterisk-code-review mailing list