Example #1
0
CALLBACK(filter_odd, bool,
	void *data, enumerator_t *orig, va_list args)
{
	int *item, *out;

	VA_ARGS_VGET(args, out);

	fail_if(data != (void*)101, "data does not match '101' in filter function");

	while (orig->enumerate(orig, &item))
	{
		if (*item % 2 == 0)
		{
			*out = *item;
			return TRUE;
		}
	}
	return FALSE;
}
Example #2
0
CALLBACK(filter, bool,
	void *data, enumerator_t *orig, va_list args)
{
	revoked_t *revoked;
	crl_reason_t *reason;
	chunk_t *serial;
	time_t *date;

	VA_ARGS_VGET(args, serial, date, reason);

	if (orig->enumerate(orig, &revoked))
	{
		*serial = revoked->serial;
		*date = revoked->date;
		*reason = revoked->reason;
		return TRUE;
	}
	return FALSE;
}
Example #3
0
CALLBACK(filter, bool,
	int *data, enumerator_t *orig, va_list args)
{
	int *item, *vo, *wo, *xo, *yo, *zo;

	VA_ARGS_VGET(args, vo, wo, xo, yo, zo);

	if (orig->enumerate(orig, &item))
	{
		int val = *item;
		*vo = val++;
		*wo = val++;
		*xo = val++;
		*yo = val++;
		*zo = val++;
		fail_if(data != (void*)101, "data does not match '101' in filter function");
		return TRUE;
	}
	return FALSE;
}