mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 23:08:32 +00:00
Merged revisions 331265 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r331265 | rmudgett | 2011-08-09 18:12:49 -0500 (Tue, 09 Aug 2011) | 22 lines Merged revisions 331248 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r331248 | rmudgett | 2011-08-09 17:12:59 -0500 (Tue, 09 Aug 2011) | 15 lines Misc minor items found in code. * Add some reentrancy protection in pbx.c when creating the contexts_table hash table. * Fix inverted test in chan_sip.c conditional code. * Fix uninitialized variable and use of the wrong variable in chan_iax2.c. * Fix test of return value in app_parkandannounce.c. Explicitly testing for -1 is bad if the function does not actually return that value when it fails. * Fixup some comments and add some curly braces in features.c. ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@331266 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
19
main/pbx.c
19
main/pbx.c
@@ -7177,12 +7177,17 @@ struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts,
|
||||
int length = sizeof(struct ast_context) + strlen(name) + 1;
|
||||
|
||||
if (!contexts_table) {
|
||||
contexts_table = ast_hashtab_create(17,
|
||||
ast_hashtab_compare_contexts,
|
||||
ast_hashtab_resize_java,
|
||||
ast_hashtab_newsize_java,
|
||||
ast_hashtab_hash_contexts,
|
||||
0);
|
||||
/* Protect creation of contexts_table from reentrancy. */
|
||||
ast_wrlock_contexts();
|
||||
if (!contexts_table) {
|
||||
contexts_table = ast_hashtab_create(17,
|
||||
ast_hashtab_compare_contexts,
|
||||
ast_hashtab_resize_java,
|
||||
ast_hashtab_newsize_java,
|
||||
ast_hashtab_hash_contexts,
|
||||
0);
|
||||
}
|
||||
ast_unlock_contexts();
|
||||
}
|
||||
|
||||
ast_copy_string(search.name, name, sizeof(search.name));
|
||||
@@ -7402,7 +7407,7 @@ void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_
|
||||
|
||||
begintime = ast_tvnow();
|
||||
ast_mutex_lock(&context_merge_lock);/* Serialize ast_merge_contexts_and_delete */
|
||||
ast_rdlock_contexts();
|
||||
ast_wrlock_contexts();
|
||||
iter = ast_hashtab_start_traversal(contexts_table);
|
||||
while ((tmp = ast_hashtab_next(iter))) {
|
||||
context_merge(extcontexts, exttable, tmp, registrar);
|
||||
|
||||
Reference in New Issue
Block a user