Optional API: Fix handling of sources that are both provider and user.
authorCorey Farrell <git@cfware.com>
Mon, 13 Apr 2015 10:57:02 +0000 (06:57 -0400)
committerCorey Farrell <git@cfware.com>
Mon, 13 Apr 2015 11:06:28 +0000 (07:06 -0400)
commitfbc8ddfe6395fa7ff61a56ddd9695eb554011709
treefe6ea59bcff94ad4e2390c545a414adb199d2599
parent1174ef588dafe864fe3f2c1f8297690def8f85d1
Optional API: Fix handling of sources that are both provider and user.

OPTIONAL_API has conditionals to define AST_OPTIONAL_API and
AST_OPTIONAL_API_ATTR differently based on if AST_API_MODULE is defined.
Unfortunately this is inside the include protection block, so only the
first status of AST_API_MODULE is respected.  For example res_monitor
is an optional API provider, but uses func_periodic_hook.  This makes
func_periodic_hook non-optional to res_monitor.

This changes optional_api.h so that AST_OPTIONAL_API and
AST_OPTIONAL_API_ATTR is redefined every time the header is included.

ASTERISK-17608 #close
Reported by: Warren Selby

Change-Id: I8fcf2a5e7b481893e17484ecde4f172c9ffb5679
include/asterisk/optional_api.h