mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 07:18:15 +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:
@@ -149,7 +149,7 @@ static int hash_string(const void *obj, const int flags)
|
||||
return total;
|
||||
}
|
||||
|
||||
static int hashtab_compare_strings(void *a, void *b, int flags)
|
||||
static int hashtab_compare_strings(void *a, void *b, void *data, int flags)
|
||||
{
|
||||
const struct inclfile *ae = a, *be = b;
|
||||
return !strcmp(ae->fname, be->fname) ? CMP_MATCH | CMP_STOP : 0;
|
||||
@@ -1509,7 +1509,7 @@ static void set_fn(char *fn, int fn_size, const char *file, const char *configfi
|
||||
else
|
||||
snprintf(fn, fn_size, "%s/%s", ast_config_AST_CONFIG_DIR, file);
|
||||
lookup.fname = fn;
|
||||
*fi = ao2_find(fileset, &lookup, OBJ_POINTER);
|
||||
*fi = ao2_find(fileset, &lookup, NULL, OBJ_POINTER);
|
||||
if (!(*fi)) {
|
||||
/* set up a file scratch pad */
|
||||
struct inclfile *fx = ao2_alloc(sizeof(struct inclfile), inclfile_destroy);
|
||||
|
||||
Reference in New Issue
Block a user