Received: from eggs.gnu.org ([2001:4830:134:3::10]:34075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1s0h-0005jS-Le for qemu-devel@nongnu.org; Thu, 26 Nov 2015 03:34:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1s0c-000188-L0 for qemu-devel@nongnu.org; Thu, 26 Nov 2015 03:34:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43929) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1s0c-000183-FM for qemu-devel@nongnu.org; Thu, 26 Nov 2015 03:34:30 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id D4E2A8E22B for ; Thu, 26 Nov 2015 08:34:29 +0000 (UTC) From: Markus Armbruster References: <1448486613-17634-1-git-send-email-armbru@redhat.com> <1448486613-17634-8-git-send-email-armbru@redhat.com> <565632CC.1010501@redhat.com> Date: Thu, 26 Nov 2015 09:34:27 +0100 In-Reply-To: <565632CC.1010501@redhat.com> (Eric Blake's message of "Wed, 25 Nov 2015 15:14:36 -0700") Message-ID: <877fl5ma5o.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v3 for-2.5 07/12] qjson: Inline token_is_escape() and simplify List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com Eric Blake writes: > On 11/25/2015 02:23 PM, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster >> --- >> qobject/json-parser.c | 32 +++++++++++++++----------------- >> 1 file changed, 15 insertions(+), 17 deletions(-) >> > >> + if (!strcmp(val, "%p")) { >> obj = va_arg(*ap, QObject *); >> - } else if (token_is_escape(token, "%i")) { >> + } else if (!strcmp(val, "%i")) { >> obj = QOBJECT(qbool_from_bool(va_arg(*ap, int))); >> - } else if (token_is_escape(token, "%d")) { >> + } else if (!strcmp(val, "%d")) { >> obj = QOBJECT(qint_from_int(va_arg(*ap, int))); >> - } else if (token_is_escape(token, "%ld")) { >> + } else if (!strcmp(val, "%ld")) { > > Not for this patch, but I'd love to kill our support for "%ld" - it has > behavior that differs between 32-bit and 64-bit platforms, and is > therefore useless for our goal of using fixed-width integer types. > >> obj = QOBJECT(qint_from_int(va_arg(*ap, long))); >> - } else if (token_is_escape(token, "%lld") || >> - token_is_escape(token, "%I64d")) { >> + } else if (!strcmp(val, "%lld") || >> + !strcmp(val, "%I64d")) { > > Not for this patch, but I'd love to kill our support for "%I64d". Isn't > modern mingw friendlier to using POSIX escape sequences in printf()? > I'm assuming mingw is the only reason we have this hold-out? These escapes are chosen so we can get type checking from gcc via format attribute. The code here is somewhat unclean; it should arguably compare to "%" PRId64, whatever that may be. Instead, we accept anything we anticipate it could be. > Reviewed-by: Eric Blake Thanks!