The function is marked as unused. Remove it from the tree
until a new use case can be found.
Signed-off-by: Yi Li <yili(a)winhong.com>
---
tools/virsh-domain.c | 115 -------------------------------------------
1 file changed, 115 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ef347585e8..1ae936c6b2 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -11933,121 +11933,6 @@ cmdDomHostname(vshControl *ctl, const vshCmd *cmd)
return true;
}
-/**
- * Check if n1 is superset of n2, meaning n1 contains all elements and
- * attributes as n2 at least. Including children.
- * @n1 first node
- * @n2 second node
- * returns true in case n1 covers n2, false otherwise.
- */
-G_GNUC_UNUSED
-static bool
-virshNodeIsSuperset(xmlNodePtr n1, xmlNodePtr n2)
-{
- xmlNodePtr child1, child2;
- xmlAttrPtr attr;
- char *prop1, *prop2;
- bool found;
- bool visited;
- bool ret = false;
- long n1_child_size, n2_child_size, n1_iter;
- virBitmapPtr bitmap;
-
- if (!n1 && !n2)
- return true;
-
- if (!n1 || !n2)
- return false;
-
- if (!xmlStrEqual(n1->name, n2->name))
- return false;
-
- /* Iterate over n2 attributes and check if n1 contains them */
- attr = n2->properties;
- while (attr) {
- if (attr->type == XML_ATTRIBUTE_NODE) {
- prop1 = virXMLPropString(n1, (const char *) attr->name);
- prop2 = virXMLPropString(n2, (const char *) attr->name);
- if (STRNEQ_NULLABLE(prop1, prop2)) {
- xmlFree(prop1);
- xmlFree(prop2);
- return false;
- }
- xmlFree(prop1);
- xmlFree(prop2);
- }
- attr = attr->next;
- }
-
- n1_child_size = virXMLChildElementCount(n1);
- n2_child_size = virXMLChildElementCount(n2);
- if (n1_child_size < 0 || n2_child_size < 0 ||
- n1_child_size < n2_child_size)
- return false;
-
- if (n1_child_size == 0 && n2_child_size == 0)
- return true;
-
- bitmap = virBitmapNew(n1_child_size);
-
- child2 = n2->children;
- while (child2) {
- if (child2->type != XML_ELEMENT_NODE) {
- child2 = child2->next;
- continue;
- }
-
- child1 = n1->children;
- n1_iter = 0;
- found = false;
- while (child1) {
- if (child1->type != XML_ELEMENT_NODE) {
- child1 = child1->next;
- continue;
- }
-
- if (virBitmapGetBit(bitmap, n1_iter, &visited) < 0) {
- vshError(NULL, "%s", _("Bad child elements
counting."));
- goto cleanup;
- }
-
- if (visited) {
- child1 = child1->next;
- n1_iter++;
- continue;
- }
-
- if (xmlStrEqual(child1->name, child2->name)) {
- found = true;
- if (virBitmapSetBit(bitmap, n1_iter) < 0) {
- vshError(NULL, "%s", _("Bad child elements
counting."));
- goto cleanup;
- }
-
- if (!virshNodeIsSuperset(child1, child2))
- goto cleanup;
-
- break;
- }
-
- child1 = child1->next;
- n1_iter++;
- }
-
- if (!found)
- goto cleanup;
-
- child2 = child2->next;
- }
-
- ret = true;
-
- cleanup:
- virBitmapFree(bitmap);
- return ret;
-}
-
-
/*
* "detach-device" command
*/
--
2.25.3
Show replies by date
On Thu, Nov 05, 2020 at 04:37:46PM +0800, Yi Li wrote:
The function is marked as unused. Remove it from the tree
until a new use case can be found.
Signed-off-by: Yi Li <yili(a)winhong.com>
---
Reviewed-by: Erik Skultety <eskultet(a)redhat.com>