Skip to contentSkip to conversation

Remove unnecessary if

PATCH New Sean Young 1 participant 2 messages Aug 15, 2018 Media (V4L/DVB)

lore
Share & tools
lore

Sean Young

author
#0 lore raw

PATCH 1/2 Remove unnecessary if

---
 utils/ir-ctl/ir-ctl.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
utils/ir-ctl/ir-ctl.c +7 -9
index 59555a13..ddd93068 100644
@@ -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");
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/2 ir-ctl: different drivers have different default timeouts

A driver might not support setting the timeout either, in addition, if a device does not support measuring the carrier, or has no wideband receiver, this command will also produce an error.

---
 utils/ir-ctl/ir-ctl.1.in | 4 ----
 1 file changed, 4 deletions(-)
utils/ir-ctl/ir-ctl.1.in +0 -4
index f42d8da0..2a148c70 100644
@@ -224,10 +224,6 @@ To send the pulse and space file \fBplay\fR on emitter 3:
 To send the rc-5 hauppauge '1' scancode:
 .br
 	\fBir\-ctl \-S rc5:0x1e01
-.PP
-To restore the IR receiver on /dev/lirc2 to the default state:
-.br
-	\fBir\-ctl \-Mn \-\-timeout 125000 \-\-device=/dev/lirc2\fR
 .SH BUGS
 Report bugs to \fBLinux Media Mailing List <[email protected]>\fR
 .SH COPYRIGHT
Signature · 1 line
2.17.1