summaryrefslogtreecommitdiffstats
path: root/user_call
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2017-07-28 14:10:07 +0200
committerRalf Baechle <ralf@linux-mips.org>2017-07-31 04:29:44 +0200
commitdaba307035faf4cc01f1ccb883b21281d91234cc (patch)
treeedbd5df9285303f281524fac8064866057ce35ce /user_call
parent71b0582584ac5de97141ea207ddf17f7c938b2df (diff)
treewide: Kill assignments in if conditions.
Somewhat hard to read and the code base already has many overlong lines. Found with below spatch file and some manual editing in ax25/access.c to restore a comment lost by spatch. @parens@ expression E, F, G; binary operator X; statement S; @@ - if ((E = F) X G) + E = F; + if (E X G) S Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'user_call')
-rw-r--r--user_call/ax25_call.c6
-rw-r--r--user_call/netrom_call.c6
-rw-r--r--user_call/rose_call.c6
-rw-r--r--user_call/tcp_call.c3
-rw-r--r--user_call/user_io.c3
5 files changed, 16 insertions, 8 deletions
diff --git a/user_call/ax25_call.c b/user_call/ax25_call.c
index cbfc6cb..d818bbf 100644
--- a/user_call/ax25_call.c
+++ b/user_call/ax25_call.c
@@ -72,7 +72,8 @@ int main(int argc, char **argv)
axconnect.fsa_ax25.sax25_family = axbind.fsa_ax25.sax25_family = AF_AX25;
axbind.fsa_ax25.sax25_ndigis = 1;
- if ((addr = ax25_config_get_addr(argv[optind])) == NULL) {
+ addr = ax25_config_get_addr(argv[optind]);
+ if (addr == NULL) {
sprintf(buffer, "ERROR: invalid AX.25 port name - %s\r", argv[optind]);
err(buffer);
}
@@ -95,7 +96,8 @@ int main(int argc, char **argv)
/*
* Open the socket into the kernel.
*/
- if ((s = socket(AF_AX25, SOCK_SEQPACKET, 0)) < 0) {
+ s = socket(AF_AX25, SOCK_SEQPACKET, 0);
+ if (s < 0) {
sprintf(buffer, "ERROR: cannot open AX.25 socket, %s\r", strerror(errno));
err(buffer);
}
diff --git a/user_call/netrom_call.c b/user_call/netrom_call.c
index e3f9995..2ba553b 100644
--- a/user_call/netrom_call.c
+++ b/user_call/netrom_call.c
@@ -78,7 +78,8 @@ int main(int argc, char **argv)
nrbind.fsa_ax25.sax25_ndigis = 1;
nrconnect.fsa_ax25.sax25_ndigis = 0;
- if ((addr = nr_config_get_addr(argv[optind])) == NULL) {
+ addr = nr_config_get_addr(argv[optind]);
+ if (addr == NULL) {
sprintf(buffer, "ERROR: invalid NET/ROM port name - %s\r", argv[optind]);
err(buffer);
}
@@ -106,7 +107,8 @@ int main(int argc, char **argv)
/*
* Open the socket into the kernel.
*/
- if ((s = socket(AF_NETROM, SOCK_SEQPACKET, 0)) < 0) {
+ s = socket(AF_NETROM, SOCK_SEQPACKET, 0);
+ if (s < 0) {
sprintf(buffer, "ERROR: cannot open NET/ROM socket, %s\r", strerror(errno));
err(buffer);
}
diff --git a/user_call/rose_call.c b/user_call/rose_call.c
index 166307f..7a7dea1 100644
--- a/user_call/rose_call.c
+++ b/user_call/rose_call.c
@@ -73,7 +73,8 @@ int main(int argc, char **argv)
roseconnect.srose_family = rosebind.srose_family = AF_ROSE;
roseconnect.srose_ndigis = rosebind.srose_ndigis = 0;
- if ((addr = rs_config_get_addr(argv[optind])) == NULL) {
+ addr = rs_config_get_addr(argv[optind]);
+ if (addr == NULL) {
sprintf(buffer, "ERROR: invalid Rose port name - %s\r", argv[optind]);
err(buffer);
}
@@ -101,7 +102,8 @@ int main(int argc, char **argv)
/*
* Open the socket into the kernel.
*/
- if ((s = socket(AF_ROSE, SOCK_SEQPACKET, 0)) < 0) {
+ s = socket(AF_ROSE, SOCK_SEQPACKET, 0);
+ if (s < 0) {
sprintf(buffer, "ERROR: cannot open Rose socket, %s\r", strerror(errno));
err(buffer);
}
diff --git a/user_call/tcp_call.c b/user_call/tcp_call.c
index 581cd40..204638b 100644
--- a/user_call/tcp_call.c
+++ b/user_call/tcp_call.c
@@ -69,7 +69,8 @@ int main(int argc, char **argv)
/*
* Open the socket into the kernel.
*/
- if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ s = socket(AF_INET, SOCK_STREAM, 0);
+ if (s < 0) {
sprintf(buffer, "ERROR: can't open socket: %s\n", strerror(errno));
err(buffer);
}
diff --git a/user_call/user_io.c b/user_call/user_io.c
index 3c7e9d5..3bd6a26 100644
--- a/user_call/user_io.c
+++ b/user_call/user_io.c
@@ -163,7 +163,8 @@ int user_read(int fd, void *buf, size_t count)
incoming_stream.next_in = input_buffer;
incoming_stream.avail_in = 0;
- if ((len = read(fd, input_buffer, BUFLEN)) <= 0)
+ len = read(fd, input_buffer, BUFLEN);
+ if (len <= 0)
return len;
incoming_stream.avail_in = len;