aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2010-12-07 09:35:53 +0000
committerKevin Wolf <kwolf@redhat.com>2010-12-14 15:44:21 +0100
commit898c257ba8b611a01bbcd1a88836a5d217ca9568 (patch)
treea8cfa0b72236a641e5a1065d8a4ddb164be86cd7
parenteec77d9e712bd4157a4e1c0b5a9249d168add738 (diff)
qemu-option: Don't reinvent append_option_parameters()
parse_option_parameters() may need to create a new option parameter list from a template list. Use append_option_parameters() instead of duplicating the code. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--qemu-option.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/qemu-option.c b/qemu-option.c
index 1f8f41ae7d..e380fc140d 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -416,20 +416,13 @@ QEMUOptionParameter *parse_option_parameters(const char *param,
char value[256];
char *param_delim, *value_delim;
char next_delim;
- size_t num_options;
if (list == NULL) {
return NULL;
}
if (dest == NULL) {
- // Count valid options
- num_options = count_option_parameters(list);
-
- // Create a copy of the option list to fill in values
- dest = qemu_mallocz((num_options + 1) * sizeof(QEMUOptionParameter));
- allocated = dest;
- memcpy(dest, list, (num_options + 1) * sizeof(QEMUOptionParameter));
+ dest = allocated = append_option_parameters(NULL, list);
}
while (*param) {