]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testutils: Remove unused virTestClearCommandPath
authorPeter Krempa <pkrempa@redhat.com>
Tue, 6 Apr 2021 09:24:47 +0000 (11:24 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 12 Apr 2021 13:55:10 +0000 (15:55 +0200)
virCommand(ToString) now provides the functionality internally so we
don't have to keep the string-munging function around.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
tests/testutils.c
tests/testutils.h

index 8734790457757c9fcb86658109888b8d46d6bb6c..6b104405f70db713f90d98bc32a35f6a2640801f 100644 (file)
@@ -854,57 +854,6 @@ int virTestMain(int argc,
 }
 
 
-/*
- * @cmdset contains a list of command line args, eg
- *
- * "/usr/sbin/iptables --table filter --insert INPUT --in-interface virbr0 --protocol tcp --destination-port 53 --jump ACCEPT
- *  /usr/sbin/iptables --table filter --insert INPUT --in-interface virbr0 --protocol udp --destination-port 53 --jump ACCEPT
- *  /usr/sbin/iptables --table filter --insert FORWARD --in-interface virbr0 --jump REJECT
- *  /usr/sbin/iptables --table filter --insert FORWARD --out-interface virbr0 --jump REJECT
- *  /usr/sbin/iptables --table filter --insert FORWARD --in-interface virbr0 --out-interface virbr0 --jump ACCEPT"
- *
- * And we're munging it in-place to strip the path component
- * of the command line, to produce
- *
- * "iptables --table filter --insert INPUT --in-interface virbr0 --protocol tcp --destination-port 53 --jump ACCEPT
- *  iptables --table filter --insert INPUT --in-interface virbr0 --protocol udp --destination-port 53 --jump ACCEPT
- *  iptables --table filter --insert FORWARD --in-interface virbr0 --jump REJECT
- *  iptables --table filter --insert FORWARD --out-interface virbr0 --jump REJECT
- *  iptables --table filter --insert FORWARD --in-interface virbr0 --out-interface virbr0 --jump ACCEPT"
- */
-void virTestClearCommandPath(char *cmdset)
-{
-    size_t offset = 0;
-    char *lineStart = cmdset;
-    char *lineEnd = strchr(lineStart, '\n');
-
-    while (lineStart) {
-        char *dirsep;
-        char *movestart;
-        size_t movelen;
-        dirsep = strchr(lineStart, ' ');
-        if (dirsep) {
-            while (dirsep > lineStart && *dirsep != '/')
-                dirsep--;
-            if (*dirsep == '/')
-                dirsep++;
-            movestart = dirsep;
-        } else {
-            movestart = lineStart;
-        }
-        movelen = lineEnd ? lineEnd - movestart : strlen(movestart);
-
-        if (movelen) {
-            memmove(cmdset + offset, movestart, movelen + 1);
-            offset += movelen + 1;
-        }
-        lineStart = lineEnd ? lineEnd + 1 : NULL;
-        lineEnd = lineStart ? strchr(lineStart, '\n') : NULL;
-    }
-    cmdset[offset] = '\0';
-}
-
-
 virCapsPtr virTestGenericCapsInit(void)
 {
     g_autoptr(virCaps) caps = NULL;
index ff5c98a07853b3f0ebd1c5ecf01bb26468ed402f..4a49c1ca6542eea93c1d32555cd319676f9199ed 100644 (file)
@@ -46,8 +46,6 @@ char *virTestLoadFilePath(const char *p, ...)
 virJSONValuePtr virTestLoadFileJSON(const char *p, ...)
     G_GNUC_NULL_TERMINATED;
 
-void virTestClearCommandPath(char *cmdset);
-
 int virTestDifference(FILE *stream,
                       const char *expect,
                       const char *actual);