[asterisk-commits] kmoore: branch kmoore/stasis-channel_events-take2 r384809 - in /team/kmoore/s...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 4 21:11:21 CDT 2013
Author: kmoore
Date: Thu Apr 4 21:11:17 2013
New Revision: 384809
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384809
Log:
incorporate patch for string container
Modified:
team/kmoore/stasis-channel_events-take2/apps/app_stasis.c
team/kmoore/stasis-channel_events-take2/include/asterisk/astobj2.h
team/kmoore/stasis-channel_events-take2/main/astobj2.c
Modified: team/kmoore/stasis-channel_events-take2/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-channel_events-take2/apps/app_stasis.c?view=diff&rev=384809&r1=384808&r2=384809
==============================================================================
--- team/kmoore/stasis-channel_events-take2/apps/app_stasis.c (original)
+++ team/kmoore/stasis-channel_events-take2/apps/app_stasis.c Thu Apr 4 21:11:17 2013
@@ -122,16 +122,6 @@
app->channels = NULL;
}
-static int chan_hash(const void *obj, const int flags)
-{
- return ast_str_hash(obj);
-}
-
-static int chan_cmp(void *lhs, void *rhs, int flags)
-{
- return strcmp(lhs, rhs) ? 0 : CMP_MATCH;
-}
-
/*! Constructor for \ref app. */
static struct app *app_create(const char *name, stasis_app_cb handler, void *data)
{
@@ -152,7 +142,7 @@
app->handler = handler;
app->data = data;
- app->channels = ao2_container_alloc(APP_CHANNELS_BUCKETS, chan_hash, chan_cmp);
+ app->channels = ao2_str_container_alloc(APP_CHANNELS_BUCKETS);
if (!app->channels) {
return NULL;
}
Modified: team/kmoore/stasis-channel_events-take2/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-channel_events-take2/include/asterisk/astobj2.h?view=diff&rev=384809&r1=384808&r2=384809
==============================================================================
--- team/kmoore/stasis-channel_events-take2/include/asterisk/astobj2.h (original)
+++ team/kmoore/stasis-channel_events-take2/include/asterisk/astobj2.h Thu Apr 4 21:11:17 2013
@@ -1883,4 +1883,13 @@
#define ao2_cleanup(obj) __ao2_cleanup(obj)
#endif
void ao2_iterator_cleanup(struct ao2_iterator *iter);
+
+/*!
+ * \since 12
+ * \brief Allocates a hash container for bare strings
+ * \retval AO2 container for strings
+ * \retval NULL if allocation failed
+ */
+struct ao2_container *ao2_str_container_alloc(int buckets);
+
#endif /* _ASTERISK_ASTOBJ2_H */
Modified: team/kmoore/stasis-channel_events-take2/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-channel_events-take2/main/astobj2.c?view=diff&rev=384809&r1=384808&r2=384809
==============================================================================
--- team/kmoore/stasis-channel_events-take2/main/astobj2.c (original)
+++ team/kmoore/stasis-channel_events-take2/main/astobj2.c Thu Apr 4 21:11:17 2013
@@ -5714,3 +5714,18 @@
return 0;
}
+
+static int str_hash(const void *obj, const int flags)
+{
+ return ast_str_hash(obj);
+}
+
+static int str_cmp(void *lhs, void *rhs, int flags)
+{
+ return strcmp(lhs, rhs) ? 0 : CMP_MATCH;
+}
+
+struct ao2_container *ao2_str_container_alloc(int buckets)
+{
+ return ao2_container_alloc(buckets, str_hash, str_cmp);
+}
More information about the asterisk-commits
mailing list