]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/link-mso19/api.c
ols: Make use of zero-initialization.
[libsigrok.git] / src / hardware / link-mso19 / api.c
index 793ec53995be79664750b3be44b26fcd8cf0bb92..dd3ff3c80c8923195b18f253f16f4b560f0f61cd 100644 (file)
@@ -53,6 +53,10 @@ static const uint64_t samplerates[] = {
        SR_HZ(100),
 };
 
+static const char *trigger_slopes[2] = {
+       "r", "f",
+};
+
 static GSList *scan(struct sr_dev_driver *di, GSList *options)
 {
        int i;
@@ -253,14 +257,9 @@ static int config_set(int key, GVariant *data,
        case SR_CONF_CAPTURE_RATIO:
                break;
        case SR_CONF_TRIGGER_SLOPE:
-               slope = g_variant_get_string(data, NULL);
-
-               if (!slope || !(slope[0] == 'f' || slope[0] == 'r'))
-                       sr_err("Invalid trigger slope");
+               if ((idx = std_str_idx(data, ARRAY_AND_SIZE(trigger_slopes))) < 0)
                        return SR_ERR_ARG;
-               }
-               devc->trigger_slope = (slope[0] == 'r')
-                       ? SLOPE_POSITIVE : SLOPE_NEGATIVE;
+               devc->trigger_slope = idx;
                break;
        case SR_CONF_HORIZ_TRIGGERPOS:
                pos = g_variant_get_double(data);
@@ -285,7 +284,7 @@ static int config_list(int key, GVariant **data,
 {
        switch (key) {
        case SR_CONF_DEVICE_OPTIONS:
-               return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
+               return STD_CONFIG_LIST(key, data, sdi, cg, NO_OPTS, drvopts, devopts);
        case SR_CONF_SAMPLERATE:
                *data = std_gvar_samplerates_steps(ARRAY_AND_SIZE(samplerates));
                break;