5 static size_t int_toSize (int x) /*@*/
7 size_t res = (size_t) x;
11 fprintf (stderr, "Error: int_toSize failure: %d", x);
24 c = (erc) malloc (sizeof (*c));
28 printf ("Malloc returned null in erc_create\n");
37 void erc_clear (erc c)
42 for (elem = c->vals; elem != 0; elem = next)
52 void erc_final (erc c)
58 bool erc_member (eref er, erc c)
62 for (tmpc = c->vals; tmpc != 0; tmpc = tmpc->next)
64 if (eref_equal (tmpc->val, er))
73 void erc_insert (erc c, eref er)
76 newElem = (ercElem *) malloc (sizeof (*newElem));
80 printf ("Malloc returned null in erc_insert\n");
85 newElem->next = c->vals;
90 bool erc_delete (erc c, eref er)
92 ercList elem = c->vals;
96 if (eref_equal (elem->val, er))
108 for (; elem != 0; prev = elem, elem = elem->next)
110 if (eref_equal (elem->val, er))
112 assert (prev != NULL);
113 prev->next = elem->next;
125 void erc_join (erc c1, erc c2)
129 for (tmpc = c2->vals; tmpc != 0; tmpc = tmpc->next)
131 erc_insert (c1, tmpc->val);
135 char *erc_sprint (erc c)
141 malloc (int_toSize (erc_size (c) * (employeePrintSize + 1) + 1));
145 printf ("Malloc returned null in erc_sprint\n");
153 employee_sprint(&(result[len]), eref_get(er));
154 len += employeePrintSize;
155 result[len++] = '\n';
162 eref erc_choose (erc c)
164 assert (c->vals != NULL);