4 static size_t int_toSize (int x)
6 size_t res = (size_t) x;
10 fprintf (stderr, "Error: int_toSize failure: %d", x);
23 c = (erc) malloc (sizeof (ercInfo));
27 printf ("Malloc returned null in erc_create\n");
36 void erc_clear (erc c)
41 for (elem = c->vals; elem != 0; elem = next)
51 void erc_final (erc c)
57 bool erc_member (eref er, erc c)
61 for (tmpc = c->vals; tmpc != 0; tmpc = tmpc->next)
62 if (eref_equal (tmpc->val, er)) return TRUE;
67 void erc_insert (erc c, eref er)
70 newElem = (ercElem *) malloc (sizeof (ercElem));
74 printf ("Malloc returned null in erc_insert\n");
79 newElem->next = c->vals;
84 bool erc_delete (erc c, eref er)
89 for (prev = 0, elem = c->vals;
91 prev = elem, elem = elem->next)
93 if (eref_equal (elem->val, er))
98 prev->next = elem->next;
109 void erc_join (erc c1, erc c2)
113 for (tmpc = c2->vals; tmpc != 0; tmpc = tmpc->next)
114 erc_insert (c1, tmpc->val);
117 char *erc_sprint (erc c)
123 malloc (int_toSize (erc_size (c) * (employeePrintSize + 1) + 1));
127 printf ("Malloc returned null in erc_sprint\n");
135 employee_sprint(&(result[len]), eref_get(er));
136 len += employeePrintSize;
137 result[len++] = '\n';