From: fenugrec Date: Wed, 30 Nov 2022 20:58:01 +0000 (-0500) Subject: new-driver: split assignment and conditional X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ce4722e3215c0e94497312a30f792226eefd7571;p=sigrok-util.git new-driver: split assignment and conditional Arguably, code is slightly easier to analyze this way, with less risk of mistaking a typo for "==" and an assignment. --- diff --git a/source/drv-protocol.c b/source/drv-protocol.c index 1b300bb..b331b6b 100644 --- a/source/drv-protocol.c +++ b/source/drv-protocol.c @@ -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) {{