From nobody Mon Feb 9 03:34:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1573660146; cv=none; d=zoho.com; s=zohoarc; b=ONDYY0rK+AqUAO8QkFMnlZPQnXY328TMSWHEGugT6qrgG3Rd4qVFuPmq490JzXARk0RLLYSR6l2QaDR12oOEQOZhR1dQuPPmq2aXW/ud+d5/5fSnogvhnA6GFnOFzpbrCKnG2AkKInpYxCnWdz5nZZ8I0NM3oj90UDHDQ1Tx3ng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573660146; 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=WQDNZfl46BW3hxrC7ElzAAsvLEDhk6Ax7FKoLTalmmo=; b=IurFQP1rLCMK6kzixSqV7r1LHHiwMU9NynhjZDbE+msb3Kp5JnwuNciX5EZQ2te2tYWPHanuaYD4l9eFUjvk6H4WS0RwC4LzhraYyg/uxzkSzQCFZrQd8UMoWgxf4f4Em/B5Ge/GLgfSNlHiU5IxOmA+nlokuinfUDZkm5pHPdI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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 1573660146294797.4889257254073; Wed, 13 Nov 2019 07:49:06 -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-307-fX6SBBcUOJahojOx_7Bp2w-1; Wed, 13 Nov 2019 10:48:41 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E36C976D8; Wed, 13 Nov 2019 15:48:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 328C610246E3; Wed, 13 Nov 2019 15:48:34 +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 D46B318034EC; Wed, 13 Nov 2019 15:48:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xADFmKCN017728 for ; Wed, 13 Nov 2019 10:48:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5695B101E58D; Wed, 13 Nov 2019 15:48:20 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-61.brq.redhat.com [10.40.200.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id B189510246F7 for ; Wed, 13 Nov 2019 15:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573660145; 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=WQDNZfl46BW3hxrC7ElzAAsvLEDhk6Ax7FKoLTalmmo=; b=gpfIeARwK3TaigkiUYQ+aPaAlUJ9hhh9MUXd74OP30fAYB2sfd1ycBjseKU9ikLatdHtXr un6CnF+//jNG7epkiI9OBNqZbD0wkl4QqYCmOV/auK63zQDyIiGCYNmvWItq2xynK++44x EOEiBHzpti5QiIw7lhJVa8pPdyhkLZE= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Wed, 13 Nov 2019 16:48:53 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/12] tests: use GRegex in vboxsnapshotxmltest 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.84 on 10.5.11.22 X-MC-Unique: fX6SBBcUOJahojOx_7Bp2w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tests/vboxsnapshotxmltest.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c index 8faf2b9c26..d1a7522931 100644 --- a/tests/vboxsnapshotxmltest.c +++ b/tests/vboxsnapshotxmltest.c @@ -4,7 +4,6 @@ =20 #ifdef WITH_VBOX =20 -# include # include "vbox/vbox_snapshot_conf.h" =20 # define VIR_FROM_THIS VIR_FROM_NONE @@ -12,7 +11,7 @@ static const char *testSnapshotXMLVariableLineRegexStr =3D "lastStateChange=3D[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0= -9]{2}Z"; =20 -regex_t *testSnapshotXMLVariableLineRegex =3D NULL; +GRegex *testSnapshotXMLVariableLineRegex =3D NULL; =20 static char * testFilterXML(char *xml) @@ -29,8 +28,7 @@ testFilterXML(char *xml) VIR_FREE(xml); =20 for (xmlLine =3D xmlLines; *xmlLine; xmlLine++) { - if (regexec(testSnapshotXMLVariableLineRegex, - *xmlLine, 0, NULL, 0) =3D=3D 0) + if (g_regex_match(testSnapshotXMLVariableLineRegex, *xmlLine, 0, N= ULL)) continue; =20 virBufferStrcat(&buf, *xmlLine, "\n", NULL); @@ -112,12 +110,12 @@ static int mymain(void) { int ret =3D 0; - if (VIR_ALLOC(testSnapshotXMLVariableLineRegex) < 0) - goto cleanup; + g_autoptr(GError) err =3D NULL; + + testSnapshotXMLVariableLineRegex =3D g_regex_new(testSnapshotXMLVariab= leLineRegexStr, + 0, 0, &err); =20 - if (regcomp(testSnapshotXMLVariableLineRegex, - testSnapshotXMLVariableLineRegexStr, - REG_EXTENDED | REG_NOSUB) !=3D 0) { + if (!testSnapshotXMLVariableLineRegex) { ret =3D -1; virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "failed to compile test regex"); @@ -136,9 +134,7 @@ mymain(void) DO_TEST("2disks-3snap-brother"); =20 cleanup: - if (testSnapshotXMLVariableLineRegex) - regfree(testSnapshotXMLVariableLineRegex); - VIR_FREE(testSnapshotXMLVariableLineRegex); + g_regex_unref(testSnapshotXMLVariableLineRegex); return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list