[PATCH 06/13] logger: simplify if clause [oclint]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This has effect of collapsing rather long indentation block, so commit
separately.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 misc-utils/logger.c | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index 9f2940c..8a1f7d6 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -927,32 +927,32 @@ static void logger_stdin(struct logger_ctl *ctl)
 	c = getchar();
 	while (c != EOF) {
 		i = 0;
-		if (ctl->prio_prefix) {
-			if (c == '<') {
-				pri = 0;
+		if (ctl->prio_prefix && c == '<') {
+			pri = 0;
+			buf[i++] = c;
+			while (isdigit(c = getchar()) && pri <= 191) {
+				buf[i++] = c;
+				pri = pri * 10 + c - '0';
+			}
+			if (c != EOF && c != '\n')
 				buf[i++] = c;
-				while (isdigit(c = getchar()) && pri <= 191) {
-					buf[i++] = c;
-					pri = pri * 10 + c - '0';
-				}
-				if (c != EOF && c != '\n')
-					buf[i++] = c;
-				if (c == '>' && 0 <= pri && pri <= 191) { /* valid RFC PRI values */
-					i = 0;
-					if (pri < 8)
-						pri |= 8; /* kern facility is forbidden */
-					ctl->pri = pri;
-				} else
-					ctl->pri = default_priority;
-
-				if (ctl->pri != last_pri) {
-					has_header = 0;
-					max_usrmsg_size = ctl->max_message_size - strlen(ctl->hdr);
-					last_pri = ctl->pri;
-				}
-				if (c != EOF && c != '\n')
-					c = getchar();
+			if (c == '>' && 0 <= pri && pri <= 191) {
+				/* valid RFC PRI values */
+				i = 0;
+				if (pri < 8)	/* kern facility is forbidden */
+					pri |= 8;
+				ctl->pri = pri;
+			} else
+				ctl->pri = default_priority;
+
+			if (ctl->pri != last_pri) {
+				has_header = 0;
+				max_usrmsg_size =
+				    ctl->max_message_size - strlen(ctl->hdr);
+				last_pri = ctl->pri;
 			}
+			if (c != EOF && c != '\n')
+				c = getchar();
 		}
 
 		while (c != EOF && c != '\n' && i < max_usrmsg_size) {
-- 
2.9.0

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux