static switch_status_t switch_loadable_module_process(char *key, switch_loadable_module_t *new_module, switch_hash_t *event_hash)
{
switch_event_t *event;
- int *event_num = NULL;
- char str_event_num[12];
- void *val;
int added = 0;
- if (event_hash) {
- if ((val = switch_core_hash_find(event_hash, "0"))) {
- event_num = (int*)val;
- } else {
- if (!(event_num = malloc(sizeof(int)))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Allocation error.\n");
- return SWITCH_STATUS_MEMERR;
- }
-
- *event_num = 0;
- switch_core_hash_insert(event_hash, "0", (const void*)event_num);
- }
- }
-
new_module->key = switch_core_strdup(new_module->pool, key);
switch_mutex_lock(loadable_modules.mutex);
if (!event_hash) {
switch_event_fire(&event);
} else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
switch_event_fire(&event);
}
else {
- sprintf(str_event_num, "%i", ++*event_num);
- switch_core_hash_insert(event_hash, (const char*)str_event_num, (const void*)event);
+ switch_core_hash_insert_pointer(event_hash, (const void*)event);
}
added++;
if (switch_loadable_module_load_module_ex((char *)path, (char *)val, SWITCH_FALSE, global, &err, SWITCH_LOADABLE_MODULE_TYPE_PRELOAD, event_hash) == SWITCH_STATUS_GENERR) {
if (critical && switch_true(critical)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to load critical module '%s', abort()\n", val);
-
- if ((hash_val = switch_core_hash_find(event_hash, "0"))) {
- switch_safe_free(hash_val);
- }
switch_core_hash_destroy(&event_hash);
abort();
if (switch_core_sqldb_init(&err) != SWITCH_STATUS_SUCCESS)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Loading modules interrupted. [Error: %s]\n", err);
- if ((hash_val = switch_core_hash_find(event_hash, "0"))) {
- switch_safe_free(hash_val);
- }
switch_core_hash_destroy(&event_hash);
return SWITCH_STATUS_GENERR;
}
/* sqldb is ready. Fire holding events! */
- if ((hash_val = switch_core_hash_find(event_hash, "0"))) {
- switch_safe_free(hash_val);
- switch_core_hash_delete(event_hash, "0");
- }
-
for (hi = switch_core_hash_first(event_hash); hi; hi = switch_core_hash_next(&hi)) {
switch_core_hash_this(hi, NULL, NULL, &hash_val);
event = (switch_event_t *)hash_val;