From nobody Tue May 13 18:26:39 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530481486166995.0598965443133; Sun, 1 Jul 2018 14:44:46 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id DCEFF356CA; Sun, 1 Jul 2018 21:44:44 +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 A4F855DD72; Sun, 1 Jul 2018 21:44:44 +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 578733FA54; Sun, 1 Jul 2018 21:44:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w61LiLBx009060 for ; Sun, 1 Jul 2018 17:44:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2F13960177; Sun, 1 Jul 2018 21:44:21 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2759A60175 for ; Sun, 1 Jul 2018 21:44:18 +0000 (UTC) Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A37523695F for ; Sun, 1 Jul 2018 21:44:07 +0000 (UTC) Received: by mail-pf0-f181.google.com with SMTP id v9-v6so5401802pff.9 for ; Sun, 01 Jul 2018 14:44:07 -0700 (PDT) Received: from centos.localdomain ([157.37.164.55]) by smtp.gmail.com with ESMTPSA id v68-v6sm15006933pfv.143.2018.07.01.14.44.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Jul 2018 14:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=RUWpILjk2geXenu2wmZYP56qH8ah8eKVmQbibOwTK2o=; b=jpDfwEMtsMw/LJXwmsxmcXpzfhgiUchTwH7iaPk0K5lWi2kmt8vdZZSDury8qpdqNd f5I5WRf7Zh3i6oCLPJZ3VND2lJG5/7DecDJeGOX6qIFJsXtHRcPg+skoj33tX6vP7J7q pYIFo9OWBZ0VW5ly6c3jp+d/WDKJKwi71Iw8DiOG+h5cclSxh/drviPZfbB2WuOVTSaU 1gGL0rxpxvqio5WXDScIArHIRWsfFB9pmG0/IhAaEr2cXfQd7b73Y3r4GsafFipWw2O+ U3nrRXYzkty6CXuDLJeLqXKLIyOwtAqr8cnJ66B2jGhUo6R6mrNDL3OfBAFk4CySeZP+ 5Wpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=RUWpILjk2geXenu2wmZYP56qH8ah8eKVmQbibOwTK2o=; b=odIUp7exC+AC0kmpqskXH4X18u7EKfFO8clvGSYa55LTucCm8hCYJTgTVhoTThAL0E bjp8pG3jilVjkuG39VGI8SznR2e+X45G87bjj4lmmpq4nYl2rzPqnUihZPwnHA5n4WNY /DmvA8qqXTkB7i3+fV5JBvhKRXSNrfbDktJeMwxIClojg2utsfC26/xcZj8kgbRoGR0l EUAciX2THN/+OZmd8RG0zvDiYePp2xVYW+IQHGAfoINLT+8Ba5MbjhFC54No4BarWhJ7 PZBr/UiYTnOP6OjY3GxIA3LDezQsnYhCclqFvOBFtWbHe/W19edHzNLLDG80wXwYZ9/T NMmA== X-Gm-Message-State: APt69E0v4SewowET1KTbrLwkA3GazzS/Laor8w2Nw0umX2QPY68rld8L C4BugLqdhyLVJjU/T7QhVlZNUabs X-Google-Smtp-Source: ADUXVKLQUwOR24iOmjsYW19kFOTDej7MhmQy4xyrSMP2IsiS87QSoclIVjAfRHmvo4lUkJSw75NhRw== X-Received: by 2002:a63:951e:: with SMTP id p30-v6mr19525044pgd.318.1530481446896; Sun, 01 Jul 2018 14:44:06 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 30 Jun 2018 14:30:11 +0530 Message-Id: <1530349239-22049-8-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1530349239-22049-1-git-send-email-skrtbhtngr@gmail.com> References: <1530349239-22049-1-git-send-email-skrtbhtngr@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sun, 01 Jul 2018 21:44:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sun, 01 Jul 2018 21:44:07 +0000 (UTC) for IP:'209.85.192.181' DOMAIN:'mail-pf0-f181.google.com' HELO:'mail-pf0-f181.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.785 * (DATE_IN_PAST_24_48, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_DKIM_INVALID) 209.85.192.181 mail-pf0-f181.google.com 209.85.192.181 mail-pf0-f181.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 07/35] util: string: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sun, 01 Jul 2018 21:44:45 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in src/util/viralloc.h, define a new wrapper around an existing cleanup function which will be called when a variable declared with VIR_AUTOPTR macro goes out of scope. When a list of strings (virString *) is declared using VIR_AUTOPTR, the function virStringListFree will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virstring.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/virstring.h b/src/util/virstring.h index ac930fd..726e02b 100644 --- a/src/util/virstring.h +++ b/src/util/virstring.h @@ -25,6 +25,7 @@ # include =20 # include "internal.h" +# include "viralloc.h" =20 typedef char *virString; =20 @@ -311,4 +312,6 @@ int virStringParsePort(const char *str, unsigned int *port) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; =20 +VIR_DEFINE_AUTOPTR_FUNC(virString, virStringListFree) + #endif /* __VIR_STRING_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list