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

@@ -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);