From nobody Sun Feb 8 18:13:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534409455043776.9166886607092; Thu, 16 Aug 2018 01:50:55 -0700 (PDT) Received: from localhost ([::1]:54301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqDzW-0001Vq-6H for importer@patchew.org; Thu, 16 Aug 2018 04:50:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqDmo-000182-6s for qemu-devel@nongnu.org; Thu, 16 Aug 2018 04:37:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqDmb-0005LV-M4 for qemu-devel@nongnu.org; Thu, 16 Aug 2018 04:37:33 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51372 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fqDmS-00059J-Cs for qemu-devel@nongnu.org; Thu, 16 Aug 2018 04:37:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 77A554012997 for ; Thu, 16 Aug 2018 08:37:04 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-56.ams2.redhat.com [10.36.116.56]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 531C110190 for ; Thu, 16 Aug 2018 08:37:04 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id F3DC91138666; Thu, 16 Aug 2018 10:37:01 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Thu, 16 Aug 2018 10:36:45 +0200 Message-Id: <20180816083701.3932-10-armbru@redhat.com> In-Reply-To: <20180816083701.3932-1-armbru@redhat.com> References: <20180816083701.3932-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 16 Aug 2018 08:37:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 16 Aug 2018 08:37:04 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 09/25] test-qobject-input-visitor: Avoid format string ambiguity X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When visitor_input_test_init_internal()'s argument @ap is null, then @json_string is interpreted literally, else it's gets %-escapes interpolated. This is awkward. One caller always passes null @ap, and the others never do. Lift the building of the QObject into the callers, where it can be done without such ambiguity. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-10-armbru@redhat.com> --- tests/test-qobject-input-visitor.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-= visitor.c index 0f4d234c3f..caa90b3d7e 100644 --- a/tests/test-qobject-input-visitor.c +++ b/tests/test-qobject-input-visitor.c @@ -47,15 +47,13 @@ static void visitor_input_teardown(TestInputVisitorData= *data, /* The various test_init functions are provided instead of a test setup function so that the JSON string used by the tests are kept in the test functions (and not in main()). */ -static Visitor *visitor_input_test_init_internal(TestInputVisitorData *dat= a, - bool keyval, - const char *json_string, - va_list *ap) + +static Visitor *test_init_internal(TestInputVisitorData *data, bool keyval, + QObject *obj) { visitor_input_teardown(data, NULL); =20 - data->obj =3D qobject_from_jsonv(json_string, ap, &error_abort); - g_assert(data->obj); + data->obj =3D obj; =20 if (keyval) { data->qiv =3D qobject_input_visitor_new_keyval(data->obj); @@ -75,7 +73,8 @@ Visitor *visitor_input_test_init_full(TestInputVisitorDat= a *data, va_list ap; =20 va_start(ap, json_string); - v =3D visitor_input_test_init_internal(data, keyval, json_string, &ap); + v =3D test_init_internal(data, keyval, + qobject_from_vjsonf_nofail(json_string, ap)); va_end(ap); return v; } @@ -88,7 +87,8 @@ Visitor *visitor_input_test_init(TestInputVisitorData *da= ta, va_list ap; =20 va_start(ap, json_string); - v =3D visitor_input_test_init_internal(data, false, json_string, &ap); + v =3D test_init_internal(data, false, + qobject_from_vjsonf_nofail(json_string, ap)); va_end(ap); return v; } @@ -103,7 +103,8 @@ Visitor *visitor_input_test_init(TestInputVisitorData *= data, static Visitor *visitor_input_test_init_raw(TestInputVisitorData *data, const char *json_string) { - return visitor_input_test_init_internal(data, false, json_string, NULL= ); + return test_init_internal(data, false, + qobject_from_json(json_string, &error_abort)= ); } =20 static void test_visitor_in_int(TestInputVisitorData *data, --=20 2.17.1