- case SR_CONF_DATA_SOURCE: {
- tmp_str = g_variant_get_string(data, NULL);
- for (i = 0; i < ARRAY_SIZE(data_sources); i++)
- if (!strcmp(tmp_str, data_sources[i])) {
- devc->data_source = i;
- break;
- }
- if (i == ARRAY_SIZE(data_sources))
- return SR_ERR;
+ case SR_CONF_DATA_SOURCE:
+ if ((idx = std_str_idx(data, ARRAY_AND_SIZE(data_sources))) < 0)
+ return SR_ERR_ARG;
+ devc->data_source = idx;