void xmlListSort(xmlListPtr l) { xmlListPtr lTemp; if (l == NULL) return; if(xmlListEmpty(l)) return; if (NULL ==(lTemp = xmlListDup(l))) return; xmlListClear(l); xmlListMerge(l, lTemp); xmlListDelete(lTemp); return; }
/** * xmlListSort: * @param l a list * * Sort all the elements in the list */ void xmlListSort(xmlListPtr list) { xmlListPtr lTemp; if(xmlListEmpty(list)) return; /* I think that the real answer is to implement quicksort, the * alternative is to implement some list copying procedure which * would be based on a list copy followed by a clear followed by * an insert. This is slow... */ if (NULL ==(lTemp = xmlListDup(list))) return; xmlListClear(list); xmlListMerge(list, lTemp); xmlListDelete(lTemp); return; }