src/stdlib/listener.c
/*===============================================
 * delete_listener -- Remove one callback from a callback list
 *  (removes first instance)
 *=============================================*/
- Remove one callback from a callback list
(removes first instance)
- Remove one callback from a callback list ( removes first instance )
void
delete_listener (LIST * notifiees, CALLBACK_FNC fncptr, VPTR uparm)
{
	LIST lold = 0;
	BOOLEAN found = FALSE;
	if (!*notifiees || is_empty_list(*notifiees))
		return;
	lold = *notifiees;
	*notifiees = create_list2(LISTDOFREE);
	while (!is_empty_list(lold)) {
		struct callback_info * info = (struct callback_info *)pop_list(lold);
		if (!found && info->fnc == fncptr && info->uparm == uparm) {
			found = TRUE;
			info->fnc = NULL;
			stdfree(info);
		} else {
			enqueue_list(*notifiees, (VPTR)info);
		}
	}
	destroy_empty_list(lold);
	if (is_empty_list(*notifiees)) {
		remove_listeners(notifiees);
	}
}
void delete_listener ( LIST * notifiees , CALLBACK_FNC fncptr , VPTR uparm ) { LIST lold = 0 ; BOOLEAN found = FALSE ; if ( ! * notifiees || is_empty_list ( * notifiees ) ) return ; lold = * notifiees ; * notifiees = create_list2 ( LISTDOFREE ) ; while ( ! is_empty_list ( lold ) ) { struct callback_info * info = ( struct callback_info * ) pop_list ( lold ) ; if ( ! found && info -> fnc == fncptr && info -> uparm == uparm ) { found = TRUE ; info -> fnc = NULL ; stdfree ( info ) ; } else { enqueue_list ( * notifiees , ( VPTR ) info ) ; } } destroy_empty_list ( lold ) ; if ( is_empty_list ( * notifiees ) ) { remove_listeners ( notifiees ) ; } }
delete_listener -- Remove one callback from a callback list
  (removes first instance)
delete_listener -- Remove one callback from a callback list ( removes first instance )
/* Our lists don't have remove from middle, so we just make a new copy */