[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/14] qemu-option: Don't reinvent append_option_par
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 11/14] qemu-option: Don't reinvent append_option_parameters() |
Date: |
Thu, 9 Dec 2010 12:10:07 +0100 |
From: Stefan Hajnoczi <address@hidden>
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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-option.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/qemu-option.c b/qemu-option.c
index 1f8f41a..e380fc1 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) {
--
1.7.2.3
- [Qemu-devel] [PULL 00/14] Block patches, Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 01/14] block: Make bdrv_create_file() ':' handling consistent, Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 03/14] Use qemu_mallocz() instead of calloc() in img_convert(), Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 02/14] Add missing tracing to qemu_mallocz(), Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 05/14] Consolidate printing of block driver options, Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 07/14] Fail if detecting an unknown option, Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 06/14] Fix formatting and missing braces in qemu-img.c, Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 04/14] img_convert(): Only try to free bs[] entries if bs is valid., Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 08/14] Make error handling more consistent in img_create() and img_resize(), Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 10/14] qemu-img: Deprecate obsolete -6 and -e options, Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 11/14] qemu-option: Don't reinvent append_option_parameters(),
Kevin Wolf <=
- [Qemu-devel] [PATCH 12/14] qemu-option: Fix parse_option_parameters() documentation typo, Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 09/14] ceph/rbd block driver for qemu-kvm, Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 14/14] qemu-img: Fail creation if backing format is invalid, Kevin Wolf, 2010/12/09
- [Qemu-devel] [PATCH 13/14] qemu-img: Free option parameter lists in img_create(), Kevin Wolf, 2010/12/09
- [Qemu-devel] Re: [PULL 00/14] Block patches, Kevin Wolf, 2010/12/15
- Re: [Qemu-devel] [PULL 00/14] Block patches, Anthony Liguori, 2010/12/17