From nobody Mon Feb 9 08:59:48 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1713532792373471.2974441819289; Fri, 19 Apr 2024 06:19:52 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 529E31D8E; Fri, 19 Apr 2024 09:19:51 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 598151DB5; Fri, 19 Apr 2024 09:06:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id DA7831D1E; Fri, 19 Apr 2024 09:06:34 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3C6E51D8E for ; Fri, 19 Apr 2024 09:05:44 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-199-qSBaYiqSOUyVwVEslU4S4w-1; Fri, 19 Apr 2024 09:05:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1B4E318065AE for ; Fri, 19 Apr 2024 13:05:42 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 840512166B32 for ; Fri, 19 Apr 2024 13:05:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: qSBaYiqSOUyVwVEslU4S4w-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 09/13] vsh: Unexport command lookup helpers 'vshCmddefSearch', 'vshCmdGrpSearch', 'vshCmdGrpHelp' Date: Fri, 19 Apr 2024 15:05:27 +0200 Message-ID: <7a7855427587ab503901d45c815030f967ebe250.1713531810.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: R73AIUPR26BBL5REZ4OX5JSZOSU6MMGX X-Message-ID-Hash: R73AIUPR26BBL5REZ4OX5JSZOSU6MMGX X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1713532792923100001 Neither of them is used outside of vsh.c. 'vshCmddefSearch' needed to be rearranged as it was called earlier in vsh.c than it was defined. Signed-off-by: Peter Krempa --- tools/vsh.c | 44 ++++++++++++++++++++++++++------------------ tools/vsh.h | 4 ---- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 1d8aecc41b..256ba55a83 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -239,6 +239,30 @@ vshReportError(vshControl *ctl) */ static int disconnected; /* we may have been disconnected */ + +/* vshCmddefSearch: + * @cmdname: name of command to find + * + * Looks for @cmdname in the global list of command definitions @cmdGroups= and + * returns pointer to the definition struct if the command exists. + */ +static const vshCmdDef * +vshCmddefSearch(const char *cmdname) +{ + const vshCmdGrp *g; + const vshCmdDef *c; + + for (g =3D cmdGroups; g->name; g++) { + for (c =3D g->commands; c->name; c++) { + if (STREQ(c->name, cmdname)) + return c; + } + } + + return NULL; +} + + /* Check if the internal command definitions are correct. * None of the errors are to be marked as translatable. */ static int @@ -600,23 +624,7 @@ vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd= , uint64_t opts_required, return -1; } -const vshCmdDef * -vshCmddefSearch(const char *cmdname) -{ - const vshCmdGrp *g; - const vshCmdDef *c; - - for (g =3D cmdGroups; g->name; g++) { - for (c =3D g->commands; c->name; c++) { - if (STREQ(c->name, cmdname)) - return c; - } - } - - return NULL; -} - -const vshCmdGrp * +static const vshCmdGrp * vshCmdGrpSearch(const char *grpname) { const vshCmdGrp *g; @@ -629,7 +637,7 @@ vshCmdGrpSearch(const char *grpname) return NULL; } -bool +static bool vshCmdGrpHelp(vshControl *ctl, const vshCmdGrp *grp) { const vshCmdDef *cmd =3D NULL; diff --git a/tools/vsh.h b/tools/vsh.h index a9c5b674bb..20eaf10022 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -244,10 +244,6 @@ void vshOutputLogFile(vshControl *ctl, int log_level, = const char *format, G_GNUC_PRINTF(3, 0); void vshCloseLogFile(vshControl *ctl); -const vshCmdDef *vshCmddefSearch(const char *cmdname); -const vshCmdGrp *vshCmdGrpSearch(const char *grpname); -bool vshCmdGrpHelp(vshControl *ctl, const vshCmdGrp *grp); - int vshCommandOptInt(vshControl *ctl, const vshCmd *cmd, const char *name, int *value) ATTRIBUTE_NONNULL(4) G_GNUC_WARN_UNUSED_RESULT; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org