From nobody Mon Feb 9 09:09:09 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=1633622337; cv=none; d=zohomail.com; s=zohoarc; b=TpgZpXVt0hN7UjwfdyJ4uqQ2pLLiklI9ZloNNuMrZsH7tnbdcXPnN2bdw1npRbO/eBQdxIh8gk/2siUyQ02ds2jsz7a+pLO1LS1ZPwfm3+hhUTGDLP7b8OgX9PJvyHIhMTqS0sjtq7dRjuWn35YxyVf93NqRR5NUVRln77PvaJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633622337; 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=rqkwxou7G3IFcDNyZznuM1k0BmRHG2fp2kmLvavcMjo=; b=F/niAlPDmc1O2vggj0iOaotjNBKrY/k4rvcO8qzvNBz6bWr9hDglQmt+aq80lK1qcaVb7IuysoYYjnNEF81bR2LFF7oJPjlnclkePR7nIvLuc2Zf15JUzCpmgzIFwKSLybxMrQ71EBJhD9UsiPNR465tFqxN2/vs3UztIFQwov4= 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) 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 1633622337399684.2929601997852; Thu, 7 Oct 2021 08:58:57 -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-529-2VPT2g_nOAKNUQOCmRHaew-1; Thu, 07 Oct 2021 11:58:54 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 63F9BB54E11; Thu, 7 Oct 2021 15:42:51 +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 435A8E88; Thu, 7 Oct 2021 15:42:51 +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 0BFBE4EA2F; Thu, 7 Oct 2021 15:42:51 +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 197FIoRO023643 for ; Thu, 7 Oct 2021 11:18:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7D5F75F4E7; Thu, 7 Oct 2021 15:18:50 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id D75965F4FD for ; Thu, 7 Oct 2021 15:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633622336; 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=rqkwxou7G3IFcDNyZznuM1k0BmRHG2fp2kmLvavcMjo=; b=arIo5AqUmTTcZz3sVUeLdtCpPjc8aMjrSpp62yrJD4fIg7F+ZmuJEFN3bDUEnDyQE6dhmF oAqmIU/PPd149MkUicMgb2U7J3dBQcjYKW/ra8pfsWMxEPkDlGbDlEy+DPY+p6zxK3XmMF lB7TtNQPI7XSLKfK45JBEqzmcuRMiug= X-MC-Unique: 2VPT2g_nOAKNUQOCmRHaew-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 016/103] virCommandGetArgList: Remove 'nargs' argument Date: Thu, 7 Oct 2021 17:17:04 +0200 Message-Id: In-Reply-To: References: 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.13 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) X-ZM-MESSAGEID: 1633622338974100001 Content-Type: text/plain; charset="utf-8" The returned argument list is a NULL-terminated string list and the only caller doesn't use the count. Remove the argument. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/vircommand.c | 4 +--- src/util/vircommand.h | 2 +- tests/qemuxml2argvtest.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 8e372c3152..fead373729 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2164,8 +2164,7 @@ virCommandToString(virCommand *cmd, int virCommandGetArgList(virCommand *cmd, - char ***args, - size_t *nargs) + char ***args) { size_t i; @@ -2175,7 +2174,6 @@ virCommandGetArgList(virCommand *cmd, } *args =3D g_new0(char *, cmd->nargs); - *nargs =3D cmd->nargs - 1; for (i =3D 1; i < cmd->nargs; i++) (*args)[i - 1] =3D g_strdup(cmd->args[i]); diff --git a/src/util/vircommand.h b/src/util/vircommand.h index fb6c3b5d12..600806a987 100644 --- a/src/util/vircommand.h +++ b/src/util/vircommand.h @@ -178,7 +178,7 @@ int virCommandToStringBuf(virCommand *cmd, bool linebreaks, bool stripCommandPath); -int virCommandGetArgList(virCommand *cmd, char ***args, size_t *nargs); +int virCommandGetArgList(virCommand *cmd, char ***args); int virCommandExec(virCommand *cmd, gid_t *groups, int ngroups) G_GNUC_WAR= N_UNUSED_RESULT; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b5fab1178c..330804f446 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -560,7 +560,6 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv, g_auto(GStrv) args =3D NULL; g_autoptr(virDomainObj) vm =3D NULL; qemuDomainObjPrivate *priv =3D NULL; - size_t nargs =3D 0; GHashTable *schema =3D NULL; g_autoptr(virCommand) cmd =3D NULL; unsigned int parseFlags =3D info->parseFlags; @@ -602,7 +601,7 @@ testCompareXMLToArgvValidateSchema(virQEMUDriver *drv, if (!(cmd =3D testCompareXMLToArgvCreateArgs(drv, vm, migrateURI, info= , flags))) return -1; - if (virCommandGetArgList(cmd, &args, &nargs) < 0) + if (virCommandGetArgList(cmd, &args) < 0) return -1; if (testCompareXMLToArgvValidateSchemaCommand(args, schema) < 0) --=20 2.31.1