+ int device_num = key_value_storage_length(&opt->autosampledevs_);
+ if(device_num <= 0) {
+ log_printf(WARNING, "autosample no devices to sample, exiting");
+ return 0;
+ }
+
+ autosample_device_t* devices = malloc(sizeof(autosample_device_t)*device_num);
+ if(!devices) {
+ log_printf(WARNING, "autosample memory error, exiting");
+ return -3;
+ }
+
+ int i = 0;
+ string_list_element_t* k = opt->autosampledevs_.keys_.first_;
+ string_list_element_t* v = opt->autosampledevs_.values_.first_;
+ while(k && v) {
+ devices[i].delay_ = atoi(v->string_);
+ devices[i].cnt_ = 0;
+ devices[i].device_name_ = k->string_;
+ k = k->next_;
+ v = v->next_;
+ }
+