]> xenbits.xensource.com Git - libvirt.git/commitdiff
vsh: Unexport command lookup helpers 'vshCmddefSearch', 'vshCmdGrpSearch', 'vshCmdGrp...
authorPeter Krempa <pkrempa@redhat.com>
Mon, 15 Apr 2024 12:09:04 +0000 (14:09 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 25 Apr 2024 12:13:19 +0000 (14:13 +0200)
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 <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/vsh.c
tools/vsh.h

index f4c127222d2100ade5793d694761cfed92054f49..89fd107965abf01fa267e6cdc13871f93257a898 100644 (file)
@@ -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 = cmdGroups; g->name; g++) {
+        for (c = 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 = cmdGroups; g->name; g++) {
-        for (c = 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 = NULL;
index 479e6abaecb4e09f65d0fbb398649b0cb3a8d663..e92667b39480e07807e15dab13c84e4ffed272b5 100644 (file)
@@ -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;