From 6afad7276402a90b3776ddeefb205978af42fdab Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 2 Aug 2017 23:25:13 +0200 Subject: Delete more assignments in if conditions. Based on below coccinelle script with a bad transformation fixed up manually. @if1@ expression E, F, G; binary operator X; statement S; @@ - if ((E = F) X G) + E = F; + if (E X G) S @if2@ expression E, F, G; binary operator X; statement S; @@ - if (G X (E = F)) + E = F; + if (E X G) S @if3@ expression E, F; statement S; @@ - if (!(E = F)) + E = F; + if (!E) S @if4@ expression E, F; statement S; @@ - if ((E = F)) + E = F; + if (E) S Signed-off-by: Ralf Baechle --- ax25/axgetput/util.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'ax25/axgetput/util.c') diff --git a/ax25/axgetput/util.c b/ax25/axgetput/util.c index a4a83c0..69adb60 100644 --- a/ax25/axgetput/util.c +++ b/ax25/axgetput/util.c @@ -116,19 +116,23 @@ char *get_fixed_filename(char *line, long size, unsigned int msg_crc, int genera *filename = 0; - if ((p = strchr(line, '\"'))) { + p = strchr(line, '\"'); + if (p) { p++; } /* security.. */ - if ((q = strrchr((p ? p : line), '/'))) { + q = strrchr((p ? p : line), '/'); + if (q) { p = ++q; } - if ((q = strrchr((p ? p : line), '\\'))) { + q = strrchr((p ? p : line), '\\'); + if (q) { p = ++q; } - if ((q = strrchr((p ? p : line), ':'))) { + q = strrchr((p ? p : line), ':'); + if (q) { p = ++q; } if (!p) { @@ -144,7 +148,8 @@ char *get_fixed_filename(char *line, long size, unsigned int msg_crc, int genera } *r = 0; strtrim(filename); - if ((q = strrchr(filename, '.'))) { + q = strrchr(filename, '.'); + if (q) { if (!*(q+1)) { /* remove trailing dots */ *q = 0; -- cgit v1.2.3