add error handling and error messages for incorrect event api usage

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9876 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West committed 2008-10-07 17:09:31 +00:00
1 parent 640803006e
commit 7aa7dd7e68
2 files changed
+36 -7

No files matched your search

+3 -5
View File
@@ -548,11 +548,13 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **ev
{
void *pop;
*event = NULL;
if (event_id != SWITCH_EVENT_CUSTOM && subclass_name) {
return SWITCH_STATUS_GENERR;
}
if (switch_queue_trypop(EVENT_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
if (switch_queue_trypop(EVENT_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS && pop) {
*event = (switch_event_t *) pop;
} else {
*event = ALLOC(sizeof(switch_event_t));
@@ -1014,10 +1016,6 @@ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, con
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Calling-Function", func);
switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Event-Calling-Line-Number", "%d", line);
if ((*event)->subclass_name) {
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Subclass", (*event)->subclass_name);
}
if (user_data) {
(*event)->event_user_data = user_data;
}