From nobody Sun Oct 5 19:12:02 2025 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504289166888344.10841293319345; Fri, 1 Sep 2017 11:06:06 -0700 (PDT) Received: from localhost ([::1]:53088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnqKT-0000Fm-Sa for importer@patchew.org; Fri, 01 Sep 2017 14:06:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnqIV-00078r-4o for qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:04:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dnqIQ-0001Zy-AF for qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:04:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34794) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dnqIQ-0001ZE-4u for qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:03:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35567C047B88 for ; Fri, 1 Sep 2017 18:03:57 +0000 (UTC) Received: from red.redhat.com (ovpn-121-149.rdu2.redhat.com [10.10.121.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98A0A627DE; Fri, 1 Sep 2017 18:03:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 35567C047B88 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eblake@redhat.com From: Eric Blake To: qemu-devel@nongnu.org Date: Fri, 1 Sep 2017 13:03:20 -0500 Message-Id: <20170901180340.30009-10-eblake@redhat.com> In-Reply-To: <20170901180340.30009-1-eblake@redhat.com> References: <20170901180340.30009-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 01 Sep 2017 18:03:57 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v6 09/29] libqtest: Use qemu_strtoul() 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: , Cc: pbonzini@redhat.com, armbru@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This will keep checkpatch happy when the next patch does code motion. Fix the include order to match HACKING when adding the needed header. Signed-off-by: Eric Blake Reviewed-by: Philippe Mathieu-Daud=C3=A9 =20 Reviewed-by: Thomas Huth --- tests/libqtest.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/libqtest.c b/tests/libqtest.c index a6ce21d7f9..438a22678d 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -15,12 +15,13 @@ * */ #include "qemu/osdep.h" -#include "libqtest.h" #include #include #include +#include "libqtest.h" +#include "qemu/cutils.h" #include "qapi/error.h" #include "qapi/qmp/json-parser.h" #include "qapi/qmp/json-streamer.h" @@ -333,12 +334,14 @@ redo: g_string_free(line, TRUE); if (strcmp(words[0], "IRQ") =3D=3D 0) { - int irq; + long irq; + int ret; g_assert(words[1] !=3D NULL); g_assert(words[2] !=3D NULL); - irq =3D strtoul(words[2], NULL, 0); + ret =3D qemu_strtol(words[2], NULL, 0, &irq); + g_assert(!ret); g_assert_cmpint(irq, >=3D, 0); g_assert_cmpint(irq, <, MAX_IRQ); @@ -701,11 +704,13 @@ void qtest_outl(QTestState *s, uint16_t addr, uint32_= t value) static uint32_t qtest_in(QTestState *s, const char *cmd, uint16_t addr) { gchar **args; - uint32_t value; + int ret; + unsigned long value; qtest_sendf(s, "%s 0x%x\n", cmd, addr); args =3D qtest_rsp(s, 2); - value =3D strtoul(args[1], NULL, 0); + ret =3D qemu_strtoul(args[1], NULL, 0, &value); + g_assert(!ret && value <=3D UINT32_MAX); g_strfreev(args); return value; @@ -756,11 +761,13 @@ void qtest_writeq(QTestState *s, uint64_t addr, uint6= 4_t value) static uint64_t qtest_read(QTestState *s, const char *cmd, uint64_t addr) { gchar **args; + int ret; uint64_t value; qtest_sendf(s, "%s 0x%" PRIx64 "\n", cmd, addr); args =3D qtest_rsp(s, 2); - value =3D strtoull(args[1], NULL, 0); + ret =3D qemu_strtou64(args[1], NULL, 0, &value); + g_assert(!ret); g_strfreev(args); return value; --=20 2.13.5