Example #1
0
/*
 * Discard all currently held path structures on q0.
 * and add all the ones on xq.
 */
static void preplace(qelem *q0, qelem *xq)
{
	/*
	 * While the list is not empty,
	 * take the first element off the list
	 * and free it.
	 */
	while (q0->q_forw != q0) {
		qelem *q = q0->q_forw;
		rem_que(q);
		pfree((path *) q);
	}
	while (xq->q_forw != xq) {
		qelem *q = xq->q_forw;
		rem_que(q);
		ins_que(q, q0);
	}
}
/*
 * Free a map.
 */
void
mapc_free(mnt_map *m)
{
	/*
	 * Decrement the reference count.
	 * If the reference count hits zero
	 * then throw the map away.
	 */
	if (m && --m->refc == 0) {
		mapc_clear(m);
		free((void *)m->map_name);
		rem_que(&m->hdr);
		free((void *)m);
	}
}