From patchwork Tue Jun 16 12:49:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?B?Wm9sdMOhbiBLxZF2w6Fnw7M=?= X-Patchwork-Id: 484971 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C7962140281 for ; Tue, 16 Jun 2015 22:50:06 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=G63L1pxM; dkim-atps=neutral Received: from localhost ([::1]:39991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4qJY-0003yW-HG for incoming@patchwork.ozlabs.org; Tue, 16 Jun 2015 08:50:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4qIm-0002n7-UI for qemu-devel@nongnu.org; Tue, 16 Jun 2015 08:49:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4qIl-0005v1-HF for qemu-devel@nongnu.org; Tue, 16 Jun 2015 08:49:16 -0400 Received: from mail-wi0-x231.google.com ([2a00:1450:400c:c05::231]:38422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4qIl-0005uU-Ai; Tue, 16 Jun 2015 08:49:15 -0400 Received: by wibdq8 with SMTP id dq8so18404034wib.1; Tue, 16 Jun 2015 05:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=2i+rscEhpZB6n7PLBVzBMkg3LxKzmKdKAmhbLI52e0I=; b=G63L1pxMLZS//cdSU54bR/qQ+FyPScA2wm64mxkCpQW5kjhadviTGJJalzjEfDxvMM c/M9HewlqXFiuH9mLrLncFBJunDRJsMDtlcMpuotu4X/YeO90DO9MktxGq2XdJFWh3b1 gSTqzIP6lqffr5+tSG9MxddTdnv0inqCpcPXbNSvWs0nFTh7xfQpnIC8bv1vYw2mENzI s4GU9j0P/1w8Pk9MFU795oo6qxOU8HA8wvUUOgrSj91JbWf9NIRLzN7wBCLfjGnq/qMT OM37fsxfV5GvcQVcsiUpL4OHLDpxB6+AU+YkQZrHt5/xOHfHNslqt8iq7xHKL04qXtIn oAAA== X-Received: by 10.180.104.197 with SMTP id gg5mr43486716wib.27.1434458954456; Tue, 16 Jun 2015 05:49:14 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (178-164-167-192.pool.digikabel.hu. [178.164.167.192]) by mx.google.com with ESMTPSA id ez19sm20657456wid.19.2015.06.16.05.49.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jun 2015 05:49:13 -0700 (PDT) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?= To: qemu-devel@nongnu.org Date: Tue, 16 Jun 2015 14:49:06 +0200 Message-Id: <06990ada8a0d0beb9bb942b5b9ddc1c19a9a4664.1434458391.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::231 Cc: Kevin Wolf , Gerd Hoffmann , "open list:Block layer core" Subject: [Qemu-devel] [PATCH v2 3/6] opts: do not print separator before first item in qemu_opts_print X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This allows to print options in a format that the user would actually write it on the command line (foo=bar,baz=asd,etc=def), without prepending a spurious comma at the beginning of the list. Only block.c depended on the old behavior, but it was also updated. Signed-off-by: Kővágó, Zoltán Reviewed-by: Markus Armbruster Acked-by: Kevin Wolf --- block.c | 2 +- util/qemu-option.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index dd4f58d..c5d456c 100644 --- a/block.c +++ b/block.c @@ -3823,7 +3823,7 @@ void bdrv_img_create(const char *filename, const char *fmt, } if (!quiet) { - printf("Formatting '%s', fmt=%s", filename, fmt); + printf("Formatting '%s', fmt=%s ", filename, fmt); qemu_opts_print(opts, " "); puts(""); } diff --git a/util/qemu-option.c b/util/qemu-option.c index 840f5f7..b347d92 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -728,14 +728,16 @@ void qemu_opts_del(QemuOpts *opts) g_free(opts); } -void qemu_opts_print(QemuOpts *opts, const char *sep) +void qemu_opts_print(QemuOpts *opts, const char *d_sep) { QemuOpt *opt; QemuOptDesc *desc = opts->list->desc; + const char *sep = ""; if (desc[0].name == NULL) { QTAILQ_FOREACH(opt, &opts->head, next) { printf("%s%s=\"%s\"", sep, opt->name, opt->str); + sep = d_sep; } return; } @@ -755,6 +757,7 @@ void qemu_opts_print(QemuOpts *opts, const char *sep) } else { printf("%s%s=%s", sep, desc->name, value); } + sep = d_sep; } }