qemu-option.c (2d40fa6987e26a4273ca8c57487e8bd61f409cc4) qemu-option.c (9aebf3b89281a173d2dfeee379b800be5e3f363e)
1/*
2 * Commandline option parsing functions
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 * Copyright (c) 2009 Kevin Wolf <kwolf@redhat.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

--- 627 unchanged lines hidden (view full) ---

636 }
637 if (opts->id && id && !strcmp(opts->id, id)) {
638 return opts;
639 }
640 }
641 return NULL;
642}
643
1/*
2 * Commandline option parsing functions
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 * Copyright (c) 2009 Kevin Wolf <kwolf@redhat.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal

--- 627 unchanged lines hidden (view full) ---

636 }
637 if (opts->id && id && !strcmp(opts->id, id)) {
638 return opts;
639 }
640 }
641 return NULL;
642}
643
644static int id_wellformed(const char *id)
644int qemu_opts_id_wellformed(const char *id)
645{
646 int i;
647
648 if (!qemu_isalpha(id[0])) {
649 return 0;
650 }
651 for (i = 1; id[i]; i++) {
652 if (!qemu_isalnum(id[i]) && !strchr("-._", id[i])) {

--- 4 unchanged lines hidden (view full) ---

657}
658
659QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,
660 int fail_if_exists, Error **errp)
661{
662 QemuOpts *opts = NULL;
663
664 if (id) {
645{
646 int i;
647
648 if (!qemu_isalpha(id[0])) {
649 return 0;
650 }
651 for (i = 1; id[i]; i++) {
652 if (!qemu_isalnum(id[i]) && !strchr("-._", id[i])) {

--- 4 unchanged lines hidden (view full) ---

657}
658
659QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,
660 int fail_if_exists, Error **errp)
661{
662 QemuOpts *opts = NULL;
663
664 if (id) {
665 if (!id_wellformed(id)) {
665 if (!qemu_opts_id_wellformed(id)) {
666 error_set(errp,QERR_INVALID_PARAMETER_VALUE, "id", "an identifier");
667#if 0 /* conversion from qerror_report() to error_set() broke this: */
668 error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n");
669#endif
670 return NULL;
671 }
672 opts = qemu_opts_find(list, id);
673 if (opts != NULL) {

--- 488 unchanged lines hidden ---
666 error_set(errp,QERR_INVALID_PARAMETER_VALUE, "id", "an identifier");
667#if 0 /* conversion from qerror_report() to error_set() broke this: */
668 error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n");
669#endif
670 return NULL;
671 }
672 opts = qemu_opts_find(list, id);
673 if (opts != NULL) {

--- 488 unchanged lines hidden ---