mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
testutils: Remove unused virTestClearCommandPath
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>
This commit is contained in:
parent
cf32c7d8c0
commit
3b0e264aa8
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user