]> sigrok.org Git - libsigrok.git/commitdiff
teleinfo: Fix a compiler warning (clang).
authorUwe Hermann <redacted>
Tue, 31 Dec 2013 18:22:16 +0000 (19:22 +0100)
committerUwe Hermann <redacted>
Tue, 31 Dec 2013 18:22:16 +0000 (19:22 +0100)
  CC       libsigrok_hw_teleinfo_la-protocol.lo
protocol.c:62:41: warning: missing field 'num_samples' initializer
      [-Wmissing-field-initializers]
        struct sr_datafeed_analog analog = { 0 };
                                               ^

hardware/teleinfo/protocol.c

index 0d7e6ce53da7bdfbf2f1c0ad78f646bf14c06d52..746d43c07210ba47af30485d82ae555ca8531bb1 100644 (file)
@@ -57,14 +57,18 @@ static struct sr_probe *teleinfo_find_probe(struct sr_dev_inst *sdi,
 static void teleinfo_send_value(struct sr_dev_inst *sdi, const char *probe_name,
                                 float value, int mq, int unit)
 {
-       struct dev_context *devc = sdi->priv;
+       struct dev_context *devc;
        struct sr_datafeed_packet packet;
-       struct sr_datafeed_analog analog = { 0 };
-       struct sr_probe *probe = teleinfo_find_probe(sdi, probe_name);
+       struct sr_datafeed_analog analog;
+       struct sr_probe *probe;
+
+       devc = sdi->priv;
+       probe = teleinfo_find_probe(sdi, probe_name);
 
        if (!probe || !probe->enabled)
                return;
 
+       memset(&analog, 0, sizeof(struct sr_datafeed_analog));
        analog.probes = g_slist_append(analog.probes, probe);
        analog.num_samples = 1;
        analog.mq = mq;