From nobody Sun Feb 8 06:49:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582489278; cv=none; d=zohomail.com; s=zohoarc; b=RNiYAq+fEo2mw0fSACG8zoR3pLQRYNNHbFlSLpaQRqcEikaJ5SQTrzKqGodPqf/CslGXV08Hcbyqc1wpfqe/Mmh+I5JTlM18DcxyqfKUH1j0Gnl2+tZGtUZtNs8Kc4EKJoS3pEs4O0WLwezwXsHoDj5XlzFiUEJu5rKKzB2bf6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582489278; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Sdak3mVGDTqZ6IeFEtYLCNxLsOjWrtCfpbZtZEX9Ni0=; b=E9u7Ruurdb+NK8DiiTKa/JMxVJh3yzUha/fbPfD8brlxZ3XXpFg2VlJLXgeKtagiJapMO+lxeHTqltE5B2agWJTTq48E8T9GQd3vcIAh9Mej2IRJ1w3d83T2YBOISowEJB44yWftzZ5ZvZNLMB8S21vQdDaqeStxU+FMU92rp8Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1582489277974813.8154475916973; Sun, 23 Feb 2020 12:21:17 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-337-F7GMHl4NMbqCrOA7u-d6hQ-1; Sun, 23 Feb 2020 15:21:14 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F5408017DF; Sun, 23 Feb 2020 20:21:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B259360BF3; Sun, 23 Feb 2020 20:21:07 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 16442860C5; Sun, 23 Feb 2020 20:21:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01NKL0qO023719 for ; Sun, 23 Feb 2020 15:21:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6844991833; Sun, 23 Feb 2020 20:21:00 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-20.brq.redhat.com [10.40.200.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5E485C105 for ; Sun, 23 Feb 2020 20:20:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582489276; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Sdak3mVGDTqZ6IeFEtYLCNxLsOjWrtCfpbZtZEX9Ni0=; b=M2TbCOrqrH7DzvRVQrkyL2POCL+CnPR2ozp8C2QVwo7s+hZYFSiMPck93SoFyjsvgcodRV JO99Hrq7bPyJhf1wQWrxS63LNx782/l2M8bDDk4zNa+gHwG7rZVWRJch3Mq5pxDIhqkY9c JLl8zqho5ACMH9dLwKA8gMZ0B1Dh6bo= X-MC-Unique: F7GMHl4NMbqCrOA7u-d6hQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] util: uuid: remove use of virHexToBin Date: Sun, 23 Feb 2020 21:20:52 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Prefer g_ascii_xdigit_value to virHexToBin. Check the return value of the function and remove the g_ascii_isxdigit calls, since they're done anyway internally. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Laine Stump --- src/util/viruuid.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/util/viruuid.c b/src/util/viruuid.c index c8ee59beee..908b09945d 100644 --- a/src/util/viruuid.c +++ b/src/util/viruuid.c @@ -29,7 +29,6 @@ #include =20 #include "internal.h" -#include "virutil.h" #include "virerror.h" #include "virlog.h" #include "viralloc.h" @@ -105,6 +104,7 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) cur++; =20 for (i =3D 0; i < VIR_UUID_BUFLEN;) { + int val; uuid[i] =3D 0; if (*cur =3D=3D 0) return -1; @@ -112,16 +112,15 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) cur++; continue; } - if (!g_ascii_isxdigit(*cur)) + if ((val =3D g_ascii_xdigit_value(*cur)) < 0) return -1; - uuid[i] =3D virHexToBin(*cur); - uuid[i] *=3D 16; + uuid[i] =3D 16 * val; cur++; if (*cur =3D=3D 0) return -1; - if (!g_ascii_isxdigit(*cur)) + if ((val =3D g_ascii_xdigit_value(*cur)) < 0) return -1; - uuid[i] +=3D virHexToBin(*cur); + uuid[i] +=3D val; i++; cur++; } --=20 2.24.1