]> sigrok.org Git - libsigrok.git/commitdiff
ols: Make use of zero-initialization.
authorv1ne <redacted>
Tue, 31 Mar 2020 16:48:05 +0000 (18:48 +0200)
committerGerhard Sittig <redacted>
Mon, 24 Aug 2020 05:24:27 +0000 (07:24 +0200)
No need to assign zero after gmalloc0(). Move comments to declaration.

Reviewed-By: Wolfram Sang <redacted>
src/hardware/openbench-logic-sniffer/protocol.c
src/hardware/openbench-logic-sniffer/protocol.h

index 7be70b3da30153ec50b4421531ef899c443505be..36a091c731d83ff2b7b9f4582dee87db7524e856 100644 (file)
@@ -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;
 }
index 7bcaed1f6699ecbcdb1463ae37cb8da3d21b68a2..873b3d8fbf0188477bf03875e9fc9e6d6f74f31c 100644 (file)
 #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;