]> sigrok.org Git - sigrok-util.git/commitdiff
new-driver: split assignment and conditional
authorfenugrec <redacted>
Wed, 30 Nov 2022 20:58:01 +0000 (15:58 -0500)
committerfenugrec <redacted>
Sat, 3 Dec 2022 02:54:55 +0000 (21:54 -0500)
Arguably, code is slightly easier to analyze this way, with less risk of
mistaking a typo for "==" and an assignment.

source/drv-protocol.c

index 1b300bbeb87331cd9931cea6a4de57610cea71a8..b331b6baa699f97744bbfaa0a28f1e366ab1ffea 100644 (file)
@@ -27,10 +27,12 @@ SR_PRIV int {lib}_receive_data(int fd, int revents, void *cb_data)
 
        (void)fd;
 
-       if (!(sdi = cb_data))
+       sdi = cb_data;
+       if (!sdi)
                return TRUE;
 
-       if (!(devc = sdi->priv))
+       devc = sdi->priv;
+       if (!devc)
                return TRUE;
 
        if (revents == G_IO_IN) {{