From nobody Mon Feb 9 08:30:50 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=1605188627; cv=none; d=zohomail.com; s=zohoarc; b=JDNQorOtVPm1U2fNLL1+TyrvIVzR6mqIW0mOcuPsx9zYDTKhAzDa5u0/dL/GdQvqAqWLDUO5Rb5dOEXfdOCISATtrIdFQY1a0u3NIaccyZFBhhzlUkZR7JYzFkg26BGJf1u8sZiqvij2CDGHQ/rWxTgQJNjFUq/TnW3sJ3uBZRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605188627; 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=Fut62sPR//YLgw37ILRnooQir7SQGH8UIV4h4G5POZw=; b=NaTB/6mF1Zh6NjiL0jlBbQOiIQ60g3S6xvu595SloHHaiR8pGbIHhCV+Ew6/sgK4ZMEW1si/KfCJIgaPZK6PugyINavq4Y2zr7m2PZn+jS33YxfaM2nme68DQ3ynrU7Zfz7UAosO3jY02rNYs0jgFi0qI4KMTvY10cZT1rKlnQk= 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) header.from= 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 1605188627241835.0406648753142; Thu, 12 Nov 2020 05:43:47 -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-279-ZT5YaXQ6PMGfVdrRUP7Lfw-1; Thu, 12 Nov 2020 08:43:43 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 85A4018B9EC1; Thu, 12 Nov 2020 13:43:37 +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 605885C1A3; Thu, 12 Nov 2020 13:43:37 +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 217EF181A07B; Thu, 12 Nov 2020 13:43:37 +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 0ACDhZoB012393 for ; Thu, 12 Nov 2020 08:43:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 926F475135; Thu, 12 Nov 2020 13:43:35 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id E91EB7513C for ; Thu, 12 Nov 2020 13:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605188626; 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=Fut62sPR//YLgw37ILRnooQir7SQGH8UIV4h4G5POZw=; b=ETvg6hbV659plHWU7mmUK6HrEexRVKIf0stWO5sKjLzz+v1I0yU59Eox4+AWAIDf4207OT qfNjoL89fSgfeJcliT3j6U0ZmoJSZVpnv7lRa1D+QQgcI0fgESprJjGAdQrYkI7myqIT9t p/A56oMQWpcAuUL68Tv7ZdAn4h73+Ts= X-MC-Unique: ZT5YaXQ6PMGfVdrRUP7Lfw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/8] tools: vshCmddefOptParse: Remove return value Date: Thu, 12 Nov 2020 14:43:04 +0100 Message-Id: <3d655b7b59da9377be180f3af3cc0c9b6221b208.1605188395.git.pkrempa@redhat.com> 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.16 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" The function can't fail so there's no need to return a value or check it in the callers. Signed-off-by: Peter Krempa --- tools/vsh.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 2de940277e..badd37c08e 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -389,13 +389,11 @@ vshCmddefCheckInternals(vshControl *ctl, } /* Parse the options associated with @cmd, i.e. test whether options are - * required or need an argument. - * - * Returns -1 on error or 0 on success, filling the caller-provided bitmaps - * which keep track of required options and options needing an argument. + * required or need an argument and fill the appropriate caller-provided b= itmaps */ -static int -vshCmddefOptParse(const vshCmdDef *cmd, uint64_t *opts_need_arg, +static void +vshCmddefOptParse(const vshCmdDef *cmd, + uint64_t *opts_need_arg, uint64_t *opts_required) { size_t i; @@ -404,7 +402,7 @@ vshCmddefOptParse(const vshCmdDef *cmd, uint64_t *opts_= need_arg, *opts_required =3D 0; if (!cmd->opts) - return 0; + return; for (i =3D 0; cmd->opts[i].name; i++) { const vshCmdOptDef *opt =3D &cmd->opts[i]; @@ -421,8 +419,6 @@ vshCmddefOptParse(const vshCmdDef *cmd, uint64_t *opts_= need_arg, if (opt->flags & VSH_OFLAG_REQ) *opts_required |=3D 1ULL << i; } - - return 0; } static vshCmdOptDef helpopt =3D { @@ -1388,14 +1384,8 @@ vshCommandParse(vshControl *ctl, vshCommandParser *p= arser, vshCmd **partial) tkdata =3D g_strdup(cmd->alias); cmd =3D vshCmddefSearch(tkdata); } - if (vshCmddefOptParse(cmd, &opts_need_arg, - &opts_required) < 0) { - if (!partial) - vshError(ctl, - _("internal error: bad options in command= : '%s'"), - tkdata); - goto syntaxError; - } + + vshCmddefOptParse(cmd, &opts_need_arg, &opts_required); VIR_FREE(tkdata); } else if (data_only) { goto get_data; --=20 2.28.0