3 plistnode_t *pCreate(int objects) {
6 //Create main structure
7 if((pile = calloc(1, sizeof(plistnode_t))) == NULL) {
8 printf("Calloc error %s %d\n", __FILE__, __LINE__);
12 //Create array of objects
13 if((pile->obj = calloc(objects, sizeof(unsigned int))) == NULL) {
14 printf("Calloc error %s %d\n", __FILE__, __LINE__);
22 plistnode_t *pInsert(plistnode_t *pile, unsigned int mid, unsigned int oid, int num_objs) {
23 plistnode_t *ptr, *tmp;
27 //Add oid into a machine that is a part of the pile linked list structure
29 if (tmp->mid == mid) {
30 tmp->obj[tmp->index] = oid;
37 //Add oid for any new machine
39 if((ptr = pCreate(num_objs)) == NULL) {
43 ptr->obj[ptr->index] = oid;
51 //Count the number of machine groups
52 int pCount(plistnode_t *pile) {
63 //Make a list of mid's for each machine group
64 int pListMid(plistnode_t *pile, unsigned int *list) {
75 // Return objects for a given mid
76 unsigned int *pSearch(plistnode_t *pile, unsigned int mid) {
88 //Delete the entire pile
89 void pDelete(plistnode_t *pile) {
90 plistnode_t *next, *tmp;