From b8e5189456583455ad84b47f75d3b150ab5bda7d Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Thu, 4 Apr 2013 18:15:34 +0000 Subject: [PATCH] Separate some event struct definitions from instantiation. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384760 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/event.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/main/event.c b/main/event.c index 508ebac9ba..1c11626bbe 100644 --- a/main/event.c +++ b/main/event.c @@ -152,10 +152,7 @@ static int ast_event_hash_presence_state_change(const void *obj, const int flags #define MAX_CACHE_ARGS 8 -/*! - * \brief Event types that are kept in the cache. - */ -static struct { +struct cache_events { /*! * \brief Container of cached events * @@ -174,7 +171,12 @@ static struct { * will be replaced. */ enum ast_event_ie_type cache_args[MAX_CACHE_ARGS]; -} ast_event_cache[AST_EVENT_TOTAL] = { +}; + +/*! + * \brief Event types that are kept in the cache. + */ +static struct cache_events ast_event_cache[AST_EVENT_TOTAL] = { [AST_EVENT_MWI] = { .hash_fn = ast_event_hash_mwi, .cache_args = { AST_EVENT_IE_MAILBOX, AST_EVENT_IE_CONTEXT }, @@ -191,7 +193,6 @@ static struct { .hash_fn = ast_event_hash_presence_state_change, .cache_args = { AST_EVENT_IE_PRESENCE_STATE, }, }, - }; /*! @@ -218,13 +219,15 @@ static const char * const event_names[AST_EVENT_TOTAL] = { [AST_EVENT_PRESENCE_STATE] = "PresenceState", }; +struct ie_map { + enum ast_event_ie_pltype ie_pltype; + const char *name; +}; + /*! * \brief IE payload types and names */ -static const struct ie_map { - enum ast_event_ie_pltype ie_pltype; - const char *name; -} ie_maps[AST_EVENT_IE_TOTAL] = { +static const struct ie_map ie_maps[AST_EVENT_IE_TOTAL] = { [AST_EVENT_IE_NEWMSGS] = { AST_EVENT_IE_PLTYPE_UINT, "NewMessages" }, [AST_EVENT_IE_OLDMSGS] = { AST_EVENT_IE_PLTYPE_UINT, "OldMessages" }, [AST_EVENT_IE_MAILBOX] = { AST_EVENT_IE_PLTYPE_STR, "Mailbox" }, -- 2.47.2