[asterisk-commits] kpfleming: branch kpfleming/optional_api r159473 - /team/kpfleming/optional_a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 26 11:43:24 CST 2008


Author: kpfleming
Date: Wed Nov 26 11:43:24 2008
New Revision: 159473

URL: http://svn.digium.com/view/asterisk?view=rev&rev=159473
Log:
instead of relying on (platform-specific) linker behavior, just make the entire AGI optional

fix a serious bug in the non-API_MODULE flavor of AST_OPTIONAL_API_ATTR


Modified:
    team/kpfleming/optional_api/include/asterisk/agi.h
    team/kpfleming/optional_api/include/asterisk/optional_api.h

Modified: team/kpfleming/optional_api/include/asterisk/agi.h
URL: http://svn.digium.com/view/asterisk/team/kpfleming/optional_api/include/asterisk/agi.h?view=diff&rev=159473&r1=159472&r2=159473
==============================================================================
--- team/kpfleming/optional_api/include/asterisk/agi.h (original)
+++ team/kpfleming/optional_api/include/asterisk/agi.h Wed Nov 26 11:43:24 2008
@@ -130,10 +130,11 @@
  * \param fd The file descriptor for the AGI session (from struct agi_state)
  * \param chan Pointer to an associated Asterisk channel, if any
  * \param fmt printf-style format string
- * \return 0 for success, -1 for failure
+ * \return 0 for success, -1 for failure, AST_OPTIONAL_API_UNAVAILABLE if res_agi is not loaded
  *
  */
-int ast_agi_send(int fd, struct ast_channel *chan, char *fmt, ...) __attribute__((format(printf, 3, 4)));
+AST_OPTIONAL_API_ATTR(int, format(printf, 3, 4), ast_agi_send, (int fd, struct ast_channel *chan, char *fmt, ...),
+		      { return AST_OPTIONAL_API_UNAVAILABLE; });
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }

Modified: team/kpfleming/optional_api/include/asterisk/optional_api.h
URL: http://svn.digium.com/view/asterisk/team/kpfleming/optional_api/include/asterisk/optional_api.h?view=diff&rev=159473&r1=159472&r2=159473
==============================================================================
--- team/kpfleming/optional_api/include/asterisk/optional_api.h (original)
+++ team/kpfleming/optional_api/include/asterisk/optional_api.h Wed Nov 26 11:43:24 2008
@@ -87,7 +87,7 @@
 #define AST_OPTIONAL_API(result, name, proto, stub)	\
 	static result __##name proto stub;		\
 	result __attribute__((weak, alias("__" __stringify(name)))) name proto;
-#define AST_OPTIONAL_API_ATTR(result, name, attr, proto, stub)		\
+#define AST_OPTIONAL_API_ATTR(result, attr, name, proto, stub)		\
 	static result __attribute__((attr)) __##name proto stub;	\
 	result __attribute__((weak, alias("__" __stringify(name)), attr)) name proto;
 #else




More information about the asterisk-commits mailing list