mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 11:42:27 +00:00
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:
@@ -93,7 +93,7 @@ AST_MUTEX_DEFINE_STATIC(cli_ping_cond_lock);
|
||||
/*! \brief The astobj2 hash callback for taskprocessors */
|
||||
static int tps_hash_cb(const void *obj, const int flags);
|
||||
/*! \brief The astobj2 compare callback for taskprocessors */
|
||||
static int tps_cmp_cb(void *obj, void *arg, int flags);
|
||||
static int tps_cmp_cb(void *obj, void *arg, void *data, int flags);
|
||||
|
||||
/*! \brief The task processing function executed by a taskprocessor */
|
||||
static void *tps_processing_function(void *data);
|
||||
@@ -335,7 +335,7 @@ static int tps_hash_cb(const void *obj, const int flags)
|
||||
}
|
||||
|
||||
/* compare callback for astobj2 */
|
||||
static int tps_cmp_cb(void *obj, void *arg, int flags)
|
||||
static int tps_cmp_cb(void *obj, void *arg, void *data, int flags)
|
||||
{
|
||||
struct ast_taskprocessor *lhs = obj, *rhs = arg;
|
||||
|
||||
@@ -415,7 +415,7 @@ struct ast_taskprocessor *ast_taskprocessor_get(char *name, enum ast_tps_options
|
||||
return NULL;
|
||||
}
|
||||
ao2_lock(tps_singletons);
|
||||
p = ao2_find(tps_singletons, &tmp_tps, OBJ_POINTER);
|
||||
p = ao2_find(tps_singletons, &tmp_tps, NULL, OBJ_POINTER);
|
||||
if (p) {
|
||||
ao2_unlock(tps_singletons);
|
||||
return p;
|
||||
|
Reference in New Issue
Block a user