linked-list: Change return value of find_first() and signature of its callback
This avoids the unportable five pointer hack.
This commit is contained in:
@@ -140,19 +140,21 @@ static void destroy_acquire(acquire_t *this)
|
||||
free(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* match an acquire entry by reqid
|
||||
*/
|
||||
static bool acquire_by_reqid(acquire_t *this, uint32_t *reqid)
|
||||
CALLBACK(acquire_by_reqid, bool,
|
||||
acquire_t *this, va_list args)
|
||||
{
|
||||
return this->reqid == *reqid;
|
||||
uint32_t reqid;
|
||||
|
||||
VA_ARGS_VGET(args, reqid);
|
||||
return this->reqid == reqid;
|
||||
}
|
||||
|
||||
/**
|
||||
* match an acquire entry by destination address
|
||||
*/
|
||||
static bool acquire_by_dst(acquire_t *this, host_t *dst)
|
||||
CALLBACK(acquire_by_dst, bool,
|
||||
acquire_t *this, va_list args)
|
||||
{
|
||||
host_t *dst;
|
||||
|
||||
VA_ARGS_VGET(args, dst);
|
||||
return this->dst && this->dst->ip_equals(this->dst, dst);
|
||||
}
|
||||
|
||||
@@ -439,8 +441,8 @@ METHOD(trap_manager_t, acquire, void,
|
||||
uint8_t mask;
|
||||
|
||||
dst->to_subnet(dst, &host, &mask);
|
||||
if (this->acquires->find_first(this->acquires, (void*)acquire_by_dst,
|
||||
(void**)&acquire, host) == SUCCESS)
|
||||
if (this->acquires->find_first(this->acquires, acquire_by_dst,
|
||||
(void**)&acquire, host))
|
||||
{
|
||||
host->destroy(host);
|
||||
ignore = TRUE;
|
||||
@@ -456,8 +458,8 @@ METHOD(trap_manager_t, acquire, void,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->acquires->find_first(this->acquires, (void*)acquire_by_reqid,
|
||||
(void**)&acquire, &reqid) == SUCCESS)
|
||||
if (this->acquires->find_first(this->acquires, acquire_by_reqid,
|
||||
(void**)&acquire, reqid))
|
||||
{
|
||||
ignore = TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user