diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2017-08-02 23:25:13 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2017-08-03 04:21:23 +0200 |
commit | 6afad7276402a90b3776ddeefb205978af42fdab (patch) | |
tree | 595886e869c364e504eacc1d472c07ae51d7bb4a /hdlcutil | |
parent | ca4de17280673efe76a95bf904d11e1fa75c62d4 (diff) |
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 <ralf@linux-mips.org>
Diffstat (limited to 'hdlcutil')
-rw-r--r-- | hdlcutil/smdiag.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/hdlcutil/smdiag.c b/hdlcutil/smdiag.c index 17ef026..14496c8 100644 --- a/hdlcutil/smdiag.c +++ b/hdlcutil/smdiag.c @@ -94,7 +94,8 @@ static int openwindow(char *disp, int constell, int samplesperbit) XColor color, dummy; XSizeHints sizehints; - if (!(display = XOpenDisplay(NULL))) + display = XOpenDisplay(NULL); + if (!display) return -1; XSetErrorHandler(x_error_handler); XAllocNamedColor(display, DefaultColormap(display, 0), "red", @@ -103,16 +104,17 @@ static int openwindow(char *disp, int constell, int samplesperbit) col_background = WhitePixel(display, 0); col_trace = BlackPixel(display, 0); attr.background_pixel = col_background; - if (!(window = XCreateWindow(display, XRootWindow(display, 0), - 200, 200, WIDTH, HEIGHT, 5, - DefaultDepth(display, 0), - InputOutput, DefaultVisual(display, 0), - CWBackPixel, &attr))) { + window = XCreateWindow(display, XRootWindow(display, 0), 200, 200, + WIDTH, HEIGHT, 5, DefaultDepth(display, 0), + InputOutput, DefaultVisual(display, 0), + CWBackPixel, &attr); + if (!window) { fprintf(stderr, "smdiag: unable to open X window\n"); exit(1); } - if (!(pixmap = XCreatePixmap(display, window, WIDTH, HEIGHT, - DefaultDepth(display, 0)))) { + pixmap = XCreatePixmap(display, window, WIDTH, HEIGHT, + DefaultDepth(display, 0)); + if (!pixmap) { fprintf(stderr, "smdiag: unable to open offscreen pixmap\n"); exit(1); } @@ -389,7 +391,8 @@ int main(int argc, char *argv[]) } else usleep(100000L); if (display) { - if ((cp = getkey())) { + cp = getkey(); + if (cp) { for (; *cp; cp++) { printf("char pressed: '%c'\n", *cp); switch (*cp) { |