From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=54258 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PwaeJ-00031h-Sf for qemu-devel@nongnu.org; Mon, 07 Mar 2011 08:39:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PwaeH-0007uB-Ph for qemu-devel@nongnu.org; Mon, 07 Mar 2011 08:38:59 -0500 Received: from mail-yx0-f173.google.com ([209.85.213.173]:48339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PwaeH-0007tv-NO for qemu-devel@nongnu.org; Mon, 07 Mar 2011 08:38:57 -0500 Received: by yxk8 with SMTP id 8so2015975yxk.4 for ; Mon, 07 Mar 2011 05:38:57 -0800 (PST) Message-ID: <4D74DFF0.9040205@codemonkey.ws> Date: Mon, 07 Mar 2011 07:38:56 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 02/22] qerror: expose a function to format an error References: <1299460984-15849-1-git-send-email-aliguori@us.ibm.com> <1299460984-15849-3-git-send-email-aliguori@us.ibm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org, Adam Litke , Markus Armbruster , Luiz Capitulino On 03/07/2011 05:14 AM, Stefan Hajnoczi wrote: > On Mon, Mar 7, 2011 at 1:22 AM, Anthony Liguori wrote: > >> This will let Error share the QError human formatting. This is only used for >> HMP. >> >> Signed-off-by: Anthony Liguori >> >> diff --git a/qerror.c b/qerror.c >> index 4855604..13d53c9 100644 >> --- a/qerror.c >> +++ b/qerror.c >> @@ -326,12 +326,18 @@ QError *qerror_from_info(const char *file, int linenr, const char *func, >> return qerr; >> } >> >> -static void parse_error(const QError *qerror, int c) >> +static void parse_error(const QErrorStringTable *entry, int c) >> { >> - qerror_abort(qerror, "expected '%c' in '%s'", c, qerror->entry->desc); >> +#if 0 >> + qerror_abort(qerror, "expected '%c' in '%s'", c, entry->desc); >> +#else >> + fprintf(stderr, "expected '%c' in '%s'", c, entry->desc); >> + abort(); >> +#endif >> > It is not obvious to me what these #if 0 are doing. Was this just a > quick hack that needs to be fixed before merge? > I should just drop the #if 0 parts. This code path should disappear once we finish the QAPI conversion. The specific path only comes into play when a QError definition is incorrect which should only happen in development. I didn't think it was worth trying to preserve the error messages as part of the code refactoring. Regards, Anthony Liguori > Stefan > >