From nobody Tue Feb 10 21:41:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1612411114; cv=none; d=zohomail.com; s=zohoarc; b=HA+8mQZBUU0VTWgE6e0WOgFStUKj42TQldGcQWsgeGufLZQeX6udxizmXPCrcMfQzBDzQagQPR0GzRV2EzRQxe5y2Nn85Y6N8by0eD969oEp/MzAcws2W/AzDUDPYALEhfS5W3UKE/ynxbRIrNT7wBEkmE+8AvwrQjvmIBCmOQ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612411114; 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=Rp8UQqZKvc9Jx3ZMczrqWZE1qvx47xeKTzcXGkjJ5wQ=; b=ejSokYDQYVQYyipIuiesWHew17K7s2MreapWYh/MJ2CG2S0DiCbgsPH1M3jQhhI0vrwgWOWGhJzQsyRA11Vh/YQJ5/3h3Hg+ajdTEtMf238MA0BDJOagv7MCIK2iw966XFWEEpzU+JYAZV68VR9ctto14KJrZ0ZVAmZMClDJDL0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612411114986594.1494151495785; Wed, 3 Feb 2021 19:58:34 -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-343-ji2yCgKrMxSGpn1qb6XiRA-1; Wed, 03 Feb 2021 22:58:31 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A7E0A8030C7; Thu, 4 Feb 2021 03:58:25 +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 872065D9EF; Thu, 4 Feb 2021 03:58:25 +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 4FF715808E; Thu, 4 Feb 2021 03:58:25 +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 1143w8pv003478 for ; Wed, 3 Feb 2021 22:58:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0A5985B697; Thu, 4 Feb 2021 03:58:08 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-199.phx2.redhat.com [10.3.112.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8DFB5B695 for ; Thu, 4 Feb 2021 03:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612411114; 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=Rp8UQqZKvc9Jx3ZMczrqWZE1qvx47xeKTzcXGkjJ5wQ=; b=SQKRi0k1Z+utgtcF6EnWxx5DJtGDlUU+YUdyoraxlBDbzlxpLV04r6hzaDFQxuYPWkC+Ka QAiR7d87O9pyImG+Z78UdjE8/vebtJAt22E2SekXIxzrjZkLneNgqQYP3ZO5aEwtLF4QOI 2NbT3ykQ9cQ/Q3KTVxOzITJRR4Swv1U= X-MC-Unique: ji2yCgKrMxSGpn1qb6XiRA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 20/24] util: rename two *Free() functions while changing VIR_FREE to g_free Date: Wed, 3 Feb 2021 22:57:47 -0500 Message-Id: <20210204035751.164765-21-laine@redhat.com> In-Reply-To: <20210204035751.164765-1-laine@redhat.com> References: <20210204035751.164765-1-laine@redhat.com> 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" dhcpHostFree() and addnHostFree() don't follow the normal pattern of *Free functions in the rest of libvirt code - they are actually more similar to the *Dispose() functions, in that they free all subordinate objects, but not the object pointed to by the argument itself. However, the arguments aren't virObjects, so it wouldn't be proper to name them *Dispose() either. They *currently* behave similar to a *Clear() function, in that they free all the subordinate objects and nullify the pointers of those objects. HOWEVER, we don't actually need or want that behavior - the two functions in question are only called as part of a higher level *Free() function, and the pointers are not referenced in any way between the time they are freed and when the parent object is freed. So, since the current name isn't correct, nor is *Dispose(), and we want to change the behavior in such a way that *Clear() also wouldn't be correct, lets name the functions *FreeContent(), which is an accurate description of what the functions do, and what we *want* them to do. And since it's such a small patch, we can go ahead and change that behavior - replacing the VIR_FREEs with g_free. Signed-off-by: Laine Stump --- src/util/virdnsmasq.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c index c21819c981..653d46bef9 100644 --- a/src/util/virdnsmasq.c +++ b/src/util/virdnsmasq.c @@ -50,20 +50,20 @@ VIR_LOG_INIT("util.dnsmasq"); #define DNSMASQ_ADDNHOSTSFILE_SUFFIX "addnhosts" =20 static void -dhcphostFree(dnsmasqDhcpHost *host) +dhcphostFreeContent(dnsmasqDhcpHost *host) { - VIR_FREE(host->host); + g_free(host->host); } =20 static void -addnhostFree(dnsmasqAddnHost *host) +addnhostFreeContent(dnsmasqAddnHost *host) { size_t i; =20 for (i =3D 0; i < host->nhostnames; i++) - VIR_FREE(host->hostnames[i]); - VIR_FREE(host->hostnames); - VIR_FREE(host->ip); + g_free(host->hostnames[i]); + g_free(host->hostnames); + g_free(host->ip); } =20 static void @@ -73,7 +73,7 @@ addnhostsFree(dnsmasqAddnHostsfile *addnhostsfile) =20 if (addnhostsfile->hosts) { for (i =3D 0; i < addnhostsfile->nhosts; i++) - addnhostFree(&addnhostsfile->hosts[i]); + addnhostFreeContent(&addnhostsfile->hosts[i]); =20 g_free(addnhostsfile->hosts); =20 @@ -270,7 +270,7 @@ hostsfileFree(dnsmasqHostsfile *hostsfile) =20 if (hostsfile->hosts) { for (i =3D 0; i < hostsfile->nhosts; i++) - dhcphostFree(&hostsfile->hosts[i]); + dhcphostFreeContent(&hostsfile->hosts[i]); =20 g_free(hostsfile->hosts); =20 --=20 2.29.2