* xmlListInsert: * @l: a list * @data: the data * * Insert data in the ordered list at the beginning for this value * * Returns 0 in case of success, 1 in case of failure */
| 265 | * Returns 0 in case of success, 1 in case of failure |
| 266 | */ |
| 267 | int |
| 268 | xmlListInsert(xmlListPtr l, void *data) |
| 269 | { |
| 270 | xmlLinkPtr lkPlace, lkNew; |
| 271 | |
| 272 | if (l == NULL) |
| 273 | return(1); |
| 274 | lkPlace = xmlListLowerSearch(l, data); |
| 275 | /* Add the new link */ |
| 276 | lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink)); |
| 277 | if (lkNew == NULL) |
| 278 | return (1); |
| 279 | lkNew->data = data; |
| 280 | lkPlace = lkPlace->prev; |
| 281 | lkNew->next = lkPlace->next; |
| 282 | (lkPlace->next)->prev = lkNew; |
| 283 | lkPlace->next = lkNew; |
| 284 | lkNew->prev = lkPlace; |
| 285 | return 0; |
| 286 | } |
| 287 | |
| 288 | /** |
| 289 | * xmlListAppend: |
no test coverage detected