loop through both a and b comparing everything, attribs, cdata, children, etc */
| 666 | |
| 667 | /* loop through both a and b comparing everything, attribs, cdata, children, etc */ |
| 668 | int 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 | |
| 715 | xode xode_insert_tagnode(xode parent, xode node) |
nothing calls this directly
no test coverage detected