xp_comm_proj/rd_dicom/Papyrus3/PapyList3.c
/********************************************************************************/
/*										*/
/*	InsertLastInList : Create a new Item at the last place in the list 	*/
/*	and insert the given Object in it.					*/
/*	return : The created cell if OK, NULL otherwise				*/
/*										*/
/********************************************************************************/
InsertLastInList : Create a new Item at the last place in the list
and insert the given Object in it.
return : The created cell if OK, NULL otherwise
InsertLastInList : Create a new Item at the last place in the list and insert the given Object in it . return : The created cell if OK NULL otherwise
Papy_List *
InsertLastInList (Papy_List **ioListP, Object *inElemToInsertP)
{
  Papy_List	*theWrkP, *theNewCellP;
  if ((theNewCellP = (Papy_List *) emalloc3 ((PapyULong) sizeof (Papy_List))) == NULL)
    return NULL;
  theNewCellP->object = inElemToInsertP;
  theNewCellP->next   = NULL;
  if (*ioListP == NULL)
    *ioListP = theNewCellP;
  else
  {
    theWrkP = *ioListP;
    while (theWrkP->next != NULL) theWrkP = theWrkP->next;
    theWrkP->next = theNewCellP;
  } 
  return theNewCellP;
}
Papy_List * InsertLastInList ( Papy_List * * ioListP , Object * inElemToInsertP ) { Papy_List * theWrkP , * theNewCellP ; if ( ( theNewCellP = ( Papy_List * ) emalloc3 ( ( PapyULong ) sizeof ( Papy_List ) ) ) == NULL ) return NULL ; theNewCellP -> object = inElemToInsertP ; theNewCellP -> next = NULL ; if ( * ioListP == NULL ) * ioListP = theNewCellP ; else { theWrkP = * ioListP ; while ( theWrkP -> next != NULL ) theWrkP = theWrkP -> next ; theWrkP -> next = theNewCellP ; } return theNewCellP ; }
InsertLastInList : Create a new Item at the last place in the list
and insert the given Object in it.
InsertLastInList : Create a new Item at the last place in the list and insert the given Object in it .
/* create the new cell and put the Object in */ /* if the ioListP is empty */ /* look for the last cell */ /* insert the new element */ /* else */