* xmlListCreate: * @deallocator: an optional deallocator function * @compare: an optional comparison function * * Create a new list * * Returns the new list or NULL in case of error */
| 185 | * Returns the new list or NULL in case of error |
| 186 | */ |
| 187 | xmlListPtr |
| 188 | xmlListCreate(xmlListDeallocator deallocator, xmlListDataCompare compare) |
| 189 | { |
| 190 | xmlListPtr l; |
| 191 | if (NULL == (l = (xmlListPtr )xmlMalloc( sizeof(xmlList)))) |
| 192 | return (NULL); |
| 193 | /* Initialize the list to NULL */ |
| 194 | memset(l, 0, sizeof(xmlList)); |
| 195 | |
| 196 | /* Add the sentinel */ |
| 197 | if (NULL ==(l->sentinel = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) { |
| 198 | xmlFree(l); |
| 199 | return (NULL); |
| 200 | } |
| 201 | l->sentinel->next = l->sentinel; |
| 202 | l->sentinel->prev = l->sentinel; |
| 203 | l->sentinel->data = NULL; |
| 204 | |
| 205 | /* If there is a link deallocator, use it */ |
| 206 | if (deallocator != NULL) |
| 207 | l->linkDeallocator = deallocator; |
| 208 | /* If there is a link comparator, use it */ |
| 209 | if (compare != NULL) |
| 210 | l->linkCompare = compare; |
| 211 | else /* Use our own */ |
| 212 | l->linkCompare = xmlLinkCompare; |
| 213 | return l; |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * xmlListSearch: |
no outgoing calls
no test coverage detected