MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / xode_cmp

Function xode_cmp

modules/xmpp/xode.c:668–712  ·  view source on GitHub ↗

loop through both a and b comparing everything, attribs, cdata, children, etc */

Source from the content-addressed store, hash-verified

666
667/* loop through both a and b comparing everything, attribs, cdata, children, etc */
668int xode_cmp(xode a, xode b)
669{
670 int ret = 0;
671
672 while(1)
673 {
674 if(a == NULL && b == NULL)
675 return 0;
676
677 if(a == NULL || b == NULL)
678 return -1;
679
680 if(xode_get_type(a) != xode_get_type(b))
681 return -1;
682
683 switch(xode_get_type(a))
684 {
685 case XODE_TYPE_ATTRIB:
686 ret = _xode_strcmp(xode_get_name(a), xode_get_name(b));
687 if(ret != 0)
688 return -1;
689 ret = _xode_strcmp(xode_get_data(a), xode_get_data(b));
690 if(ret != 0)
691 return -1;
692 break;
693 case XODE_TYPE_TAG:
694 ret = _xode_strcmp(xode_get_name(a), xode_get_name(b));
695 if(ret != 0)
696 return -1;
697 ret = xode_cmp(xode_get_firstattrib(a), xode_get_firstattrib(b));
698 if(ret != 0)
699 return -1;
700 ret = xode_cmp(xode_get_firstchild(a), xode_get_firstchild(b));
701 if(ret != 0)
702 return -1;
703 break;
704 case XODE_TYPE_CDATA:
705 ret = _xode_strcmp(xode_get_data(a), xode_get_data(b));
706 if(ret != 0)
707 return -1;
708 }
709 a = xode_get_nextsibling(a);
710 b = xode_get_nextsibling(b);
711 }
712}
713
714
715xode xode_insert_tagnode(xode parent, xode node)

Callers

nothing calls this directly

Calls 7

xode_get_typeFunction · 0.70
_xode_strcmpFunction · 0.70
xode_get_nameFunction · 0.70
xode_get_dataFunction · 0.70
xode_get_firstattribFunction · 0.70
xode_get_firstchildFunction · 0.70
xode_get_nextsiblingFunction · 0.70

Tested by

no test coverage detected