From: v1ne Date: Tue, 31 Mar 2020 16:48:05 +0000 (+0200) Subject: ols: Make use of zero-initialization. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0ccc6f7cdf3ce1a3ac1f9116b1524f2b326dd6be;p=libsigrok.git ols: Make use of zero-initialization. No need to assign zero after gmalloc0(). Move comments to declaration. Reviewed-By: Wolfram Sang --- diff --git a/src/hardware/openbench-logic-sniffer/protocol.c b/src/hardware/openbench-logic-sniffer/protocol.c index 7be70b3d..36a091c7 100644 --- a/src/hardware/openbench-logic-sniffer/protocol.c +++ b/src/hardware/openbench-logic-sniffer/protocol.c @@ -134,14 +134,7 @@ SR_PRIV struct dev_context *ols_dev_new(void) struct dev_context *devc; devc = g_malloc0(sizeof(struct dev_context)); - - /* Device-specific settings */ - devc->max_samples = devc->max_samplerate = devc->protocol_version = 0; - - /* Acquisition settings */ - devc->limit_samples = devc->capture_ratio = 0; devc->trigger_at = -1; - devc->flag_reg = 0; return devc; } diff --git a/src/hardware/openbench-logic-sniffer/protocol.h b/src/hardware/openbench-logic-sniffer/protocol.h index 7bcaed1f..873b3d8f 100644 --- a/src/hardware/openbench-logic-sniffer/protocol.h +++ b/src/hardware/openbench-logic-sniffer/protocol.h @@ -67,11 +67,13 @@ #define FLAG_DEMUX (1 << 0) struct dev_context { + /* constant device properties: */ int max_channels; uint32_t max_samples; uint32_t max_samplerate; uint32_t protocol_version; + /* acquisition-related properties: */ uint64_t cur_samplerate; uint32_t cur_samplerate_divider; uint64_t limit_samples;