From patchwork Fri Oct 18 01:11:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Xia X-Patchwork-Id: 284472 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B42EE2C00E0 for ; Fri, 18 Oct 2013 20:17:19 +1100 (EST) Received: from localhost ([::1]:56508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VX6BJ-0007bY-Pu for incoming@patchwork.ozlabs.org; Fri, 18 Oct 2013 05:17:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VX669-0000dw-V4 for qemu-devel@nongnu.org; Fri, 18 Oct 2013 05:12:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VX65z-0007FB-59 for qemu-devel@nongnu.org; Fri, 18 Oct 2013 05:11:57 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:59101) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VX65y-0007EV-DL for qemu-devel@nongnu.org; Fri, 18 Oct 2013 05:11:47 -0400 Received: from /spool/local by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 18 Oct 2013 14:41:44 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp02.in.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 18 Oct 2013 14:41:41 +0530 Received: from d28relay04.in.ibm.com (d28relay04.in.ibm.com [9.184.220.61]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id F3EB41258056 for ; Fri, 18 Oct 2013 14:42:10 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r9I9BaT134799680 for ; Fri, 18 Oct 2013 14:41:36 +0530 Received: from d28av02.in.ibm.com (localhost [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r9I9Bdhb009539 for ; Fri, 18 Oct 2013 14:41:39 +0530 Received: from RH64wenchao ([9.181.129.59]) by d28av02.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r9I9BOpJ008595; Fri, 18 Oct 2013 14:41:37 +0530 From: Wenchao Xia To: qemu-devel@nongnu.org Date: Fri, 18 Oct 2013 09:11:17 +0800 Message-Id: <1382058681-14957-10-git-send-email-xiawenc@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1382058681-14957-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1382058681-14957-1-git-send-email-xiawenc@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13101809-5816-0000-0000-00000A6E4A4E X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 122.248.162.2 Cc: kwolf@redhat.com, stefanha@gmail.com, lcapitulino@redhat.com, pbonzini@redhat.com, Wenchao Xia Subject: [Qemu-devel] [PATCH 09/13] error: print progname with error_vprintf() 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 remove additional code path about where to print the error, error_vprintf() is only the controller now, making future change easier. The logic is not changed since when cur_mon = NULL, error_vprintf() will still print to stderr. Signed-off-by: Wenchao Xia --- util/qemu-error.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/util/qemu-error.c b/util/qemu-error.c index d1e858a..c29fcbd 100644 --- a/util/qemu-error.c +++ b/util/qemu-error.c @@ -151,6 +151,15 @@ const char *error_get_progname(void) return progname; } +static void error_print_progname(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + error_vprintf(fmt, ap); + va_end(ap); +} + /* * Print current location to current monitor if we have one, else to stderr. */ @@ -161,7 +170,7 @@ static void error_print_loc(void) const char *const *argp; if (!cur_mon && progname) { - fprintf(stderr, "%s: ", progname); + error_print_progname("%s: ", progname); } switch (cur_loc->kind) { case LOC_CMDLINE: