[PATCH 1/2] Remove unnecessary if

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

 



Signed-off-by: Sean Young <sean@xxxxxxxx>
---
 utils/ir-ctl/ir-ctl.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index 59555a13..ddd93068 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -175,19 +175,17 @@ static bool strtoscancode(const char *p, unsigned *ret)
 static unsigned parse_emitters(char *p)
 {
 	unsigned emit = 0;
-	const char *sep = " ,;:";
+	static const char *sep = " ,;:";
 	char *saveptr, *q;
 
 	q = strtok_r(p, sep, &saveptr);
 	while (q) {
-		if (*q) {
-			char *endptr;
-			long e = strtol(q, &endptr, 10);
-			if ((endptr && *endptr) || e <= 0 || e > 32)
-				return 0;
+		char *endptr;
+		long e = strtol(q, &endptr, 10);
+		if ((endptr && *endptr) || e <= 0 || e > 32)
+			return 0;
 
-			emit |= 1 << (e - 1);
-		}
+		emit |= 1 << (e - 1);
 		q = strtok_r(NULL, sep, &saveptr);
 	}
 
@@ -200,7 +198,7 @@ static struct file *read_file(struct arguments *args, const char *fname)
 	int lineno = 0, lastspace = 0;
 	char line[1024];
 	int len = 0;
-	const char *whitespace = " \n\r\t";
+	static const char *whitespace = " \n\r\t";
 	struct file *f;
 
 	FILE *input = fopen(fname, "r");
-- 
2.17.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux