Add ability to pass arbitrary data to the ao2_callback_fn (called from

ao2_callback and ao2_find).  Currently, passing OBJ_POINTER to either
of these mandates that the passed 'arg' is a hashable object, making
searching for an ao2 object based on outside criteria difficult.

Reviewed by Russell and Mark M. via ReviewBoard:
    http://reviewboard.digium.com/r/36/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@155401 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Sean Bright
2008-11-07 22:39:30 +00:00
parent bd3f685f20
commit 30d1744ffc
14 changed files with 133 additions and 133 deletions

View File

@@ -295,7 +295,7 @@ static int parkinglot_hash_cb(const void *obj, const int flags)
return ast_str_hash(parkinglot->name);
}
static int parkinglot_cmp_cb(void *obj, void *arg, int flags)
static int parkinglot_cmp_cb(void *obj, void *arg, void *data, int flags)
{
struct ast_parkinglot *parkinglot = obj, *parkinglot2 = arg;
return !strcasecmp(parkinglot->name, parkinglot2->name) ? CMP_MATCH | CMP_STOP : 0;
@@ -2838,7 +2838,7 @@ struct ast_parkinglot *find_parkinglot(const char *name)
ast_copy_string(tmp_parkinglot.name, name, sizeof(tmp_parkinglot.name));
parkinglot = ao2_find(parkinglots, &tmp_parkinglot, OBJ_POINTER);
parkinglot = ao2_find(parkinglots, &tmp_parkinglot, NULL, OBJ_POINTER);
if (parkinglot && option_debug)
ast_log(LOG_DEBUG, "Found Parkinglot: %s\n", parkinglot->name);