* xmlXPtrNewLocationSetNodeSet: * @set: a node set * * Create a new xmlXPathObjectPtr of type LocationSet and initialize * it with all the nodes from @set * * Returns the newly created object. */
| 779 | * Returns the newly created object. |
| 780 | */ |
| 781 | xmlXPathObjectPtr |
| 782 | xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set) { |
| 783 | xmlXPathObjectPtr ret; |
| 784 | |
| 785 | ret = (xmlXPathObjectPtr) xmlMalloc(sizeof(xmlXPathObject)); |
| 786 | if (ret == NULL) { |
| 787 | xmlXPtrErrMemory("allocating locationset"); |
| 788 | return(NULL); |
| 789 | } |
| 790 | memset(ret, 0, sizeof(xmlXPathObject)); |
| 791 | ret->type = XPATH_LOCATIONSET; |
| 792 | if (set != NULL) { |
| 793 | int i; |
| 794 | xmlLocationSetPtr newset; |
| 795 | |
| 796 | newset = xmlXPtrLocationSetCreate(NULL); |
| 797 | if (newset == NULL) |
| 798 | return(ret); |
| 799 | |
| 800 | for (i = 0;i < set->nodeNr;i++) |
| 801 | xmlXPtrLocationSetAdd(newset, |
| 802 | xmlXPtrNewCollapsedRange(set->nodeTab[i])); |
| 803 | |
| 804 | ret->user = (void *) newset; |
| 805 | } |
| 806 | return(ret); |
| 807 | } |
| 808 | |
| 809 | /** |
| 810 | * xmlXPtrWrapLocationSet: |
no test coverage detected