From nobody Mon Feb 9 16:35:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1617285307; cv=none; d=zohomail.com; s=zohoarc; b=l4eoqj+xA/Pl6JESFWZjfNd+MSb7U59koHE1fc74dY5ApXgmVwQKkFsG5u+SDaz6dUC47bUxjNmMF1cvCgaAmyeMSS7zhHDsWH4uw/zL1qgBjN8KsYDFVTYYHVVkvtFRXFccn46WWL0q+bZjBzUY7LhYmarGn+Dz700KlVMWv3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617285307; 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=Flao8T3ET7cf/XFrFtVQd3qNfXXT1c9wFxk9TzeUOyQ=; b=jxILzY6K7OvEMVqBdoubGQjlEkWYTeb6kY+dVlyFGGzICdAGU4CFj/YB6M8dk/TCgMTgpAcGai4ueMFBWwoS0Dw+cg3cHuXD+yBZPBp8wH2wK6Du4Ws9MgO4FgpZAuLujH6ZpZf8jnj8m3ZjlIm4Mc+bMlKGDjvHMW+YwaT17nY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1617285307330668.8328391131828; Thu, 1 Apr 2021 06:55:07 -0700 (PDT) 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-596-bu8Lw9CzN7iMRK7xJ2HFFw-1; Thu, 01 Apr 2021 09:55:04 -0400 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 B40CD107B795; Thu, 1 Apr 2021 13:54:55 +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 894671001281; Thu, 1 Apr 2021 13:54:55 +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 33EF14A700; Thu, 1 Apr 2021 13:54:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 131Ds76t023402 for ; Thu, 1 Apr 2021 09:54:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0BB745C649; Thu, 1 Apr 2021 13:54:07 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E42D5C238 for ; Thu, 1 Apr 2021 13:54:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617285306; 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=Flao8T3ET7cf/XFrFtVQd3qNfXXT1c9wFxk9TzeUOyQ=; b=SPY3FHKEI8HR+rnUz7+Zi7FkV2RKkCMa8LIDZ5sXHXG89PeCLAyHUsBMJ4FM28KbbjIvIm g1C6rm8z8jcde9M/Hzb57fCujnnIYUIKUvT5Kxhcvh10L76BeiPgxBpwaXeqW8Shdo31h2 94/TlWI3L+TNqknGXvi1CnZFjMnwzyE= X-MC-Unique: bu8Lw9CzN7iMRK7xJ2HFFw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 22/39] virStorageSourceParseBackingJSONUriCookies: Use g_strsplit instead of virStringSplitCount Date: Thu, 1 Apr 2021 15:52:21 +0200 Message-Id: <8556059ae5d7784721da42e86a0e4e9881e42b50.1617285119.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.84 on 10.5.11.22 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" Count the elements after splitting the string. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage_file/storage_source_backingstore.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/storage_file/storage_source_backingstore.c b/src/storage_f= ile/storage_source_backingstore.c index bac5a043e5..9a67d64fd6 100644 --- a/src/storage_file/storage_source_backingstore.c +++ b/src/storage_file/storage_source_backingstore.c @@ -483,7 +483,6 @@ virStorageSourceParseBackingJSONUriCookies(virStorageSo= urcePtr src, { const char *cookiestr; g_auto(GStrv) cookies =3D NULL; - size_t ncookies =3D 0; size_t i; if (!virJSONValueObjectHasKey(json, "cookie")) @@ -496,13 +495,13 @@ virStorageSourceParseBackingJSONUriCookies(virStorage= SourcePtr src, return -1; } - if (!(cookies =3D virStringSplitCount(cookiestr, ";", 0, &ncookies))) + if (!(cookies =3D g_strsplit(cookiestr, ";", 0))) return -1; - src->cookies =3D g_new0(virStorageNetCookieDefPtr, ncookies); - src->ncookies =3D ncookies; + src->ncookies =3D g_strv_length(cookies); + src->cookies =3D g_new0(virStorageNetCookieDefPtr, src->ncookies); - for (i =3D 0; i < ncookies; i++) { + for (i =3D 0; i < src->ncookies; i++) { char *cookiename =3D cookies[i]; char *cookievalue; --=20 2.29.2