Boolean dl_list::insert_after(dl_list_cell_handler& new_cell, dl_list_cell_handler& old_cell ) { oid_t next_oid(old_cell -> get_forward_ptr()); new_cell -> set_backward_ptr(old_cell.its_oid()); old_cell -> set_forward_ptr(new_cell.its_oid()); if ( next_oid.icode() != 0 ) { // NOTE: non-new-list-tail case dl_list_cell_handler next_cell_hd(next_oid, storage_ptr); new_cell -> set_forward_ptr(next_cell_hd.its_oid()); next_cell_hd -> set_backward_ptr(new_cell.its_oid()); } else { // NOTE: new-list-tail case new_cell -> get_forward_ptr().become(ground); v_dl_list_tail.become(new_cell.its_oid()); } v_sz++; set_mode(HEALTH, true); insert_to_indices(new_cell); return true; }
unsigned int intern_object(void *obj) { oblist_t *node = find_node_if(&obj_eql, obj); if (node != NULL) return node->oid; if (oblist == NULL) init_oids(); if ((node = (void*)XtCalloc(1, sizeof(oblist_t))) == NULL) fatal_error("intern_object: out of memory"); node->next = oblist; node->prev = NULL; if (node->next) node->next->prev = node; node->obj = obj; node->oid = next_oid(); oblist = node; return node->oid; }