From nobody Tue May 13 18:27: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 1530481477898481.0672068308638; Sun, 1 Jul 2018 14:44:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CCE11C050DF5; Sun, 1 Jul 2018 21:44:36 +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 A058030C43AF; Sun, 1 Jul 2018 21:44:36 +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 5A9634A46D; Sun, 1 Jul 2018 21:44:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w61LiOIu009074 for ; Sun, 1 Jul 2018 17:44:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 90E75608F8; Sun, 1 Jul 2018 21:44:24 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8760F608F6 for ; Sun, 1 Jul 2018 21:44:21 +0000 (UTC) Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) (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 89079308A94B for ; Sun, 1 Jul 2018 21:44:10 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id u16-v6so6534534pfh.3 for ; Sun, 01 Jul 2018 14:44:10 -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.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Jul 2018 14:44:09 -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=hAnULWAoJNW5o/nXn95SPAEiZecXvvsUF6eR4TroI2g=; b=e0rTBcusaQ11BK3GIn8UPMsOSBFZzLFgW5OiL2uenpV0IKhZSOZ8QSqNimT67XLCKF NJ7qf+m/NKI073AEDR89DjbBV4TcCc2SdI3datJM4JGlgiDAcMx6ZOaOMgFyWfglY3ZG 73/CQcjJRX/J1k/iiE2PC4r6PikHRQLhA84q6a6wXmn60u1JtUPEMVEziTxaicJqvFwx 0pxEOOjva9w06abdb+gigcKeggD5mIfy5tGdhMfr1UaPZ9i0UB2X8CveQ02OZmssNgfJ qwfAgpHuWoW/9V22bXSoBMO7QchXwC2n0Crq7fx7vsD96VZQZIc0H1/AsSI+MESpPE7p P30g== 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=hAnULWAoJNW5o/nXn95SPAEiZecXvvsUF6eR4TroI2g=; b=Pd3iIKAhO5vKp992Y0SlSdzfhZ1AgQXw1iLKMJ4XGScq5IXLfavpR/Py1Goip9vjJm LGSE3OaNV7rio9p2j4IoTBOlLLHYDpCWqzkZPkwpF8DQr29qzePnVFVlkF0dQva3RzNA UrL73lr52Vn193JR4+pjlCPIuO3oqDPo/E3xW/6sP5ofabNyS/c1WolnD1nK6px4c4ca hRJJzDHpRws5IcG/Pbw2+mbY0lroo5RCkF0UEoJ5SDvzw6ckM9VJVZe1qFbvK4nM0w+g XBqiqyBMRw6bDKATPPRtc57axQKfM6qr1KAUDRIYq3f4bWiWjp8O9itcgMi89psqzknl y/8w== X-Gm-Message-State: APt69E1ZCKCDv7Ai5HRIEvhRnzgji1V7E4CogQAduk3S0gsYhXwSgUXy zmBBAn2Qt+exL316x5MyMw9z7oJG X-Google-Smtp-Source: ADUXVKKjVluPF+2/eYvK0tzdWbxHaKWQ1395RIO3jvI4+FGae0dpMr3cGEn7ut8GW05lKdEDUc6H8w== X-Received: by 2002:a65:64cf:: with SMTP id t15-v6mr19471935pgv.79.1530481449777; Sun, 01 Jul 2018 14:44:09 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 30 Jun 2018 14:30:12 +0530 Message-Id: <1530349239-22049-9-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.41]); Sun, 01 Jul 2018 21:44:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Sun, 01 Jul 2018 21:44:10 +0000 (UTC) for IP:'209.85.192.195' DOMAIN:'mail-pf0-f195.google.com' HELO:'mail-pf0-f195.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.195 mail-pf0-f195.google.com 209.85.192.195 mail-pf0-f195.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 08/35] util: command: 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sun, 01 Jul 2018 21:44:37 +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 variable of type virCommandPtr is declared using VIR_AUTOPTR, the function virCommandFree will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/vircommand.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/vircommand.h b/src/util/vircommand.h index 883e212..90bcc6c 100644 --- a/src/util/vircommand.h +++ b/src/util/vircommand.h @@ -24,6 +24,7 @@ =20 # include "internal.h" # include "virbuffer.h" +# include "viralloc.h" =20 typedef struct _virCommand virCommand; typedef virCommand *virCommandPtr; @@ -218,5 +219,6 @@ int virCommandRunNul(virCommandPtr cmd, virCommandRunNulFunc func, void *data); =20 +VIR_DEFINE_AUTOPTR_FUNC(virCommand, virCommandFree) =20 #endif /* __VIR_COMMAND_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list