1493
1493
PKIX_ERROR(PKIX_INPUTLISTMUSTBEHEADER);
1496
PKIX_CHECK(pkix_List_GetElement(list, index, &element, plContext),
1497
PKIX_LISTGETELEMENTFAILED);
1499
1496
/* Create a new list object */
1500
1497
PKIX_CHECK(pkix_List_Create_Internal(PKIX_FALSE, &newElem, plContext),
1501
1498
PKIX_LISTCREATEINTERNALFAILED);
1503
/* Copy the old element's contents into the new element */
1504
newElem->item = element->item;
1506
/* Set the new element's next pointer to the old element's next */
1507
newElem->next = element->next;
1509
/* Set the old element's next pointer to the new element */
1510
element->next = newElem;
1513
element->item = item;
1501
PKIX_CHECK(pkix_List_GetElement(list, index, &element, plContext),
1502
PKIX_LISTGETELEMENTFAILED);
1503
/* Copy the old element's contents into the new element */
1504
newElem->item = element->item;
1505
/* Add new item to the list */
1507
element->item = item;
1508
/* Set the new element's next pointer to the old element's next */
1509
newElem->next = element->next;
1510
/* Set the old element's next pointer to the new element */
1511
element->next = newElem;
1515
newElem->item = item;
1516
newElem->next = NULL;
1517
list->next = newElem;
1515
1522
PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1516
1523
((PKIX_PL_Object *)list, plContext),
1517
1524
PKIX_OBJECTINVALIDATECACHEFAILED);
1519
list->length = list->length + 1;
1523
if (PKIX_ERROR_RECEIVED){
1524
PKIX_DECREF(newElem);
1526
PKIX_DECREF(newElem);
1527
1528
PKIX_RETURN(LIST);