]> Git Repo - qemu.git/commitdiff
option: Add assigned flag to QEMUOptionParameter
authorMax Reitz <[email protected]>
Thu, 29 Aug 2013 09:15:44 +0000 (11:15 +0200)
committerKevin Wolf <[email protected]>
Fri, 30 Aug 2013 13:28:52 +0000 (15:28 +0200)
Adds an "assigned" flag to QEMUOptionParameter which is cleared at the
beginning of parse_option_parameters and set on (successful)
set_option_parameter and set_option_parameter_int.

Signed-off-by: Max Reitz <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
include/qemu/option.h
util/qemu-option.c

index 7a58e477d90e7987dc59ef8dd46dbabcc826aae5..63db4ccb9a4b9c9c9f62231d6377e714fb6bd5c8 100644 (file)
@@ -46,6 +46,7 @@ typedef struct QEMUOptionParameter {
         char* s;
     } value;
     const char *help;
+    bool assigned;
 } QEMUOptionParameter;
 
 
index 4ebdc4c33c46cd63d7c9eb270361cfc684f0e49b..e0844a966c9949c983037c48ecbce9895c1cfa4b 100644 (file)
@@ -275,6 +275,8 @@ int set_option_parameter(QEMUOptionParameter *list, const char *name,
         return -1;
     }
 
+    list->assigned = true;
+
     return 0;
 }
 
@@ -306,6 +308,8 @@ int set_option_parameter_int(QEMUOptionParameter *list, const char *name,
         return -1;
     }
 
+    list->assigned = true;
+
     return 0;
 }
 
@@ -397,6 +401,7 @@ QEMUOptionParameter *parse_option_parameters(const char *param,
     char value[256];
     char *param_delim, *value_delim;
     char next_delim;
+    int i;
 
     if (list == NULL) {
         return NULL;
@@ -406,6 +411,10 @@ QEMUOptionParameter *parse_option_parameters(const char *param,
         dest = allocated = append_option_parameters(NULL, list);
     }
 
+    for (i = 0; dest[i].name; i++) {
+        dest[i].assigned = false;
+    }
+
     while (*param) {
 
         // Find parameter name and value in the string
This page took 0.02773 seconds and 4 git commands to generate.