+static const char *get_opt_name_value(const char *params,
+ const char *firstname,
+ char **name, char **value)
+{
+ const char *p, *pe, *pc;
+
+ pe = strchr(params, '=');
+ pc = strchr(params, ',');
+
+ if (!pe || (pc && pc < pe)) {
+ /* found "foo,more" */
+ if (firstname) {
+ /* implicitly named first option */
+ *name = g_strdup(firstname);
+ p = get_opt_value(params, value);
static void opts_do_parse(QemuOpts *opts, const char *params,
const char *firstname, bool prepend,
bool *invalidp, Error **errp)
{
- char *option = NULL;
- char *value = NULL;
- const char *p,*pe,*pc;
Error *local_err = NULL;
+ char *option, *value;
+ const char *p;
- for (p = params; *p != '\0'; p++) {
- pe = strchr(p, '=');
- pc = strchr(p, ',');
- if (!pe || (pc && pc < pe)) {
- /* found "foo,more" */
- if (p == params && firstname) {
- /* implicitly named first option */
- option = g_strdup(firstname);
- p = get_opt_value(p, &value);