Revision ddc97855

b/qemu-config.c
212 212
    NULL,
213 213
};
214 214

  
215
static QemuOptsList *find_list(const char *group)
216
{
217
    int i;
218

  
219
    for (i = 0; lists[i] != NULL; i++) {
220
        if (strcmp(lists[i]->name, group) == 0)
221
            break;
222
    }
223
    if (lists[i] == NULL) {
224
        qemu_error("there is no option group \"%s\"\n", group);
225
    }
226
    return lists[i];
227
}
228

  
215 229
int qemu_set_option(const char *str)
216 230
{
217 231
    char group[64], id[64], arg[64];
232
    QemuOptsList *list;
218 233
    QemuOpts *opts;
219
    int i, rc, offset;
234
    int rc, offset;
220 235

  
221 236
    rc = sscanf(str, "%63[^.].%63[^.].%63[^=]%n", group, id, arg, &offset);
222 237
    if (rc < 3 || str[offset] != '=') {
......
224 239
        return -1;
225 240
    }
226 241

  
227
    for (i = 0; lists[i] != NULL; i++) {
228
        if (strcmp(lists[i]->name, group) == 0)
229
            break;
230
    }
231
    if (lists[i] == NULL) {
232
        qemu_error("there is no option group \"%s\"\n", group);
242
    list = find_list(group);
243
    if (list == NULL) {
233 244
        return -1;
234 245
    }
235 246

  
236
    opts = qemu_opts_find(lists[i], id);
247
    opts = qemu_opts_find(list, id);
237 248
    if (!opts) {
238 249
        qemu_error("there is no %s \"%s\" defined\n",
239
                lists[i]->name, id);
250
                   list->name, id);
240 251
        return -1;
241 252
    }
242 253

  

Also available in: Unified diff