コード例 #1
0
ファイル: discovery.c プロジェクト: syntacore/libjaylink
static struct jaylink_device *find_device(const struct jaylink_context *ctx,
		const struct libusb_device *usb_dev)
{
	struct list *item;

	item = list_find_custom(ctx->devs, &compare_devices, usb_dev);

	if (item)
		return item->data;

	return NULL;
}
コード例 #2
0
ファイル: event.c プロジェクト: reloZid/sdl-arena1
/**
 *  Gets the list element in the l_event_handlers list of the owning event which holds the
 *  EventHandlerInfo of a specified event handler.
 *
 *  @param id		id of the event handler
 *
 *  @returns		the list element or NULL if it couldn't be found.
 */
static List * _event_get_handler_link(int id)
{
	List *event_link;
	List *handler_link;

	EventInfo *event;

	// Iterate through all events
	event_link = list_first(l_events);
	while (event_link) {
		event = (EventInfo *)event_link->data;

		// Try to find the event handler in the list of this event
		handler_link = list_find_custom(event->l_event_handlers, &id, _event_find_handler);
		if (handler_link)
			return handler_link;

		event_link = list_next(event_link);
	}

	// We couldn't find it.
	return NULL;
}
コード例 #3
0
ファイル: event.c プロジェクト: reloZid/sdl-arena1
/**
 *  Gets the list element in the l_events list which holds the EventInfo of a specified event.
 *
 *  @param name		name of the event
 *
 *  @returns		the list element or NULL if it couldn't be found.
 */
static List * _event_get_event_link(char *name)
{
	return list_find_custom(l_events, name, _event_find_event);
}