From ce4722e3215c0e94497312a30f792226eefd7571 Mon Sep 17 00:00:00 2001 From: fenugrec Date: Wed, 30 Nov 2022 15:58:01 -0500 Subject: [PATCH] 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. --- source/drv-protocol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) {{ -- 2.11.4.GIT