From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFPjN-0008Rj-Hd for qemu-devel@nongnu.org; Fri, 30 Aug 2013 10:31:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VFPjH-0002lv-Hp for qemu-devel@nongnu.org; Fri, 30 Aug 2013 10:31:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFPjH-0002lj-9Z for qemu-devel@nongnu.org; Fri, 30 Aug 2013 10:31:15 -0400 From: Kevin Wolf Date: Fri, 30 Aug 2013 16:30:41 +0200 Message-Id: <1377873051-18981-17-git-send-email-kwolf@redhat.com> In-Reply-To: <1377873051-18981-1-git-send-email-kwolf@redhat.com> References: <1377873051-18981-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 16/26] option: Add assigned flag to QEMUOptionParameter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Max Reitz 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 Signed-off-by: Kevin Wolf --- include/qemu/option.h | 1 + util/qemu-option.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/qemu/option.h b/include/qemu/option.h index 7a58e47..63db4cc 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -46,6 +46,7 @@ typedef struct QEMUOptionParameter { char* s; } value; const char *help; + bool assigned; } QEMUOptionParameter; diff --git a/util/qemu-option.c b/util/qemu-option.c index 4ebdc4c..e0844a9 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -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 -- 1.8.1.4