[asterisk-commits] russell: branch russell/indications r174880 - /team/russell/indications/inclu...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Feb 11 10:18:03 CST 2009
Author: russell
Date: Wed Feb 11 10:18:02 2009
New Revision: 174880
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=174880
Log:
typecheckify some macros
Modified:
team/russell/indications/include/asterisk/indications.h
Modified: team/russell/indications/include/asterisk/indications.h
URL: http://svn.digium.com/svn-view/asterisk/team/russell/indications/include/asterisk/indications.h?view=diff&rev=174880&r1=174879&r2=174880
==============================================================================
--- team/russell/indications/include/asterisk/indications.h (original)
+++ team/russell/indications/include/asterisk/indications.h Wed Feb 11 10:18:02 2009
@@ -138,7 +138,7 @@
* \param zone Zone to look in for a sound, if NULL, the default will be used
* \param indication Sound to look for, such as "busy"
*
- * \return a pointer to the specified sound if it exists, NULL if not
+ * \return a reference to the specified sound if it exists, NULL if not
*/
struct ast_tone_zone_sound *ast_get_indication_tone(const struct ast_tone_zone *zone, const char *indication);
@@ -178,6 +178,17 @@
*/
struct ao2_iterator ast_tone_zone_iterator_init(void);
+extern struct ast_tone_zone __fake_tone_zone;
+extern struct ast_tone_zone_sound __fake_tone_zone_sound;
+
+#define AST_CHECK_TONE_ZONE(tz) do { \
+ (void) ((tz) == (&__fake_tone_zone)); \
+} while (0)
+
+#define AST_CHECK_TONE_ZONE_SOUND(ts) do { \
+ (void) ((ts) == (&__fake_tone_zone_sound)); \
+} while (0)
+
/*!
* \brief Lock an ast_tone_zone
*/
@@ -198,27 +209,43 @@
*
* \return NULL
*/
-#define ast_tone_zone_unref(tz) ({ ao2_ref(tz, -1); (NULL); })
+#define ast_tone_zone_unref(tz) ({ \
+ AST_CHECK_TONE_ZONE(tz); \
+ ao2_ref(tz, -1); \
+ (NULL); \
+})
/*!
* \brief Increase the reference count on an ast_tone_zone
*
* \return The tone zone provided as an argument
*/
-#define ast_tone_zone_ref(tz) ({ ao2_ref(tz, +1); (tz); })
+#define ast_tone_zone_ref(tz) ({ \
+ AST_CHECK_TONE_ZONE(tz); \
+ ao2_ref(tz, +1); \
+ (tz); \
+})
/*!
* \brief Release a reference to an ast_tone_zone_sound
*
* \return NULL
*/
-#define ast_tone_zone_sound_unref(ts) ({ ao2_ref(ts, -1); (NULL); })
+#define ast_tone_zone_sound_unref(ts) ({ \
+ AST_CHECK_TONE_ZONE_SOUND(ts); \
+ ao2_ref(ts, -1); \
+ (NULL); \
+})
/*!
* \brief Increase the reference count on an ast_tone_zone_sound
*
* \return The tone zone sound provided as an argument
*/
-#define ast_tone_zone_sound_ref(ts) ({ ao2_ref(ts, +1); (ts); })
+#define ast_tone_zone_sound_ref(ts) ({ \
+ AST_CHECK_TONE_ZONE_SOUND(ts); \
+ ao2_ref(ts, +1); \
+ (ts); \
+})
#endif /* _ASTERISK_INDICATIONS_H */
More information about the asterisk-commits
mailing list