]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hantek-dso/api.c
Channel names consistency fixes and simplifications.
[libsigrok.git] / src / hardware / hantek-dso / api.c
index 7f90b834e2eeca3115646eafad33618572b14982..c990a5c53cbb6f1901a00003c2fe161739ba99de 100644 (file)
@@ -69,7 +69,6 @@ static const uint32_t devopts_cg[] = {
 
 static const char *channel_names[] = {
        "CH1", "CH2",
-       NULL,
 };
 
 static const uint64_t buffersizes_32k[] = {
@@ -181,7 +180,7 @@ static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
         * Add only the real channels -- EXT isn't a source of data, only
         * a trigger source internal to the device.
         */
-       for (i = 0; channel_names[i]; i++) {
+       for (i = 0; i < ARRAY_SIZE(channel_names); i++) {
                ch = sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
                cg = g_malloc0(sizeof(struct sr_channel_group));
                cg->name = g_strdup(channel_names[i]);
@@ -649,7 +648,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
                return SR_ERR_ARG;
 
        if (!cg) {
-       switch (key) {
+               switch (key) {
                case SR_CONF_DEVICE_OPTIONS:
                        *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
                                        devopts, ARRAY_SIZE(devopts), sizeof(uint32_t));
@@ -683,7 +682,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
                        return SR_ERR_NA;
                }
        } else {
-       switch (key) {
+               switch (key) {
                case SR_CONF_DEVICE_OPTIONS:
                        *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
                                        devopts_cg, ARRAY_SIZE(devopts_cg), sizeof(uint32_t));