Recorded merge of revisions 222152 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r222152 | kpfleming | 2009-10-05 20:16:36 -0500 (Mon, 05 Oct 2009) | 20 lines
  
  Fix ao2_iterator API to hold references to containers being iterated.
  
  See Mantis issue for details of what prompted this change.
  
  Additional notes:
  
  This patch changes the ao2_iterator API in two ways: F_AO2I_DONTLOCK
  has become an enum instead of a macro, with a name that fits our
  naming policy; also, it is now necessary to call
  ao2_iterator_destroy() on any iterator that has been
  created. Currently this only releases the reference to the container
  being iterated, but in the future this could also release other
  resources used by the iterator, if the iterator implementation changes
  to use additional resources.
  
  (closes issue #15987)
  Reported by: kpfleming
  
  Review: https://reviewboard.asterisk.org/r/383/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@222176 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2009-10-06 01:24:24 +00:00
parent 20743ec07d
commit 1c9fe00920
12 changed files with 184 additions and 43 deletions

View File

@@ -830,6 +830,7 @@ static void delete_users(void)
ao2_unlink(users, user);
user = unref_user(user);
}
ao2_iterator_destroy(&i);
}
/*! \brief Build and return a user structure based on gathered config data */
@@ -1076,6 +1077,7 @@ static void delete_routes(void)
ao2_unlink(http_routes, route);
route = unref_route(route);
}
ao2_iterator_destroy(&i);
}
/*! \brief Delete all phone profiles, freeing their memory */
@@ -1089,6 +1091,7 @@ static void delete_profiles(void)
ao2_unlink(profiles, profile);
profile = unref_profile(profile);
}
ao2_iterator_destroy(&i);
}
/*! \brief A dialplan function that can be used to print a string for each phoneprov user */
@@ -1126,6 +1129,7 @@ static int pp_each_user_helper(struct ast_channel *chan, char *data, char *buf,
}
user = unref_user(user);
}
ao2_iterator_destroy(&i);
ast_free(str);
return 0;
@@ -1253,6 +1257,7 @@ static char *handle_show_routes(struct ast_cli_entry *e, int cmd, struct ast_cli
ast_cli(a->fd, FORMAT, route->uri, route->file->template);
route = unref_route(route);
}
ao2_iterator_destroy(&i);
ast_cli(a->fd, "\nDynamic routes\n\n");
ast_cli(a->fd, FORMAT, "Relative URI", "Template");
@@ -1263,6 +1268,7 @@ static char *handle_show_routes(struct ast_cli_entry *e, int cmd, struct ast_cli
ast_cli(a->fd, FORMAT, route->uri, route->file->template);
route = unref_route(route);
}
ao2_iterator_destroy(&i);
return CLI_SUCCESS;
}