From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VY6Fw-0007zO-8Z for qemu-devel@nongnu.org; Sun, 20 Oct 2013 23:34:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VY6Fn-0005i4-Au for qemu-devel@nongnu.org; Sun, 20 Oct 2013 23:34:12 -0400 Received: from e23smtp05.au.ibm.com ([202.81.31.147]:36003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VY6Fm-0005hu-La for qemu-devel@nongnu.org; Sun, 20 Oct 2013 23:34:03 -0400 Received: from /spool/local by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Oct 2013 13:34:00 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 97FD72CE8040 for ; Mon, 21 Oct 2013 14:33:56 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r9L3Garc11206950 for ; Mon, 21 Oct 2013 14:16:37 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r9L3Xtqx018987 for ; Mon, 21 Oct 2013 14:33:56 +1100 Message-ID: <5264A0A3.6080608@linux.vnet.ibm.com> Date: Mon, 21 Oct 2013 11:33:55 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1382058681-14957-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1382058681-14957-10-git-send-email-xiawenc@linux.vnet.ibm.com> <5261030B.3040804@redhat.com> In-Reply-To: <5261030B.3040804@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 09/13] error: print progname with error_vprintf() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, stefanha@gmail.com, qemu-devel@nongnu.org, lcapitulino@redhat.com 于 2013/10/18 17:44, Paolo Bonzini 写道: > Il 18/10/2013 03:11, Wenchao Xia ha scritto: >> 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: >> > I agree that using fprintf looks odd, but why not use error_printf directly? > > Paolo > I used custom function since I have a following modification in my private branch. Since it is not send, I will use error_printf(), which is more straight.