]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
asterisk.h: Add ASTERISK_REGISTER_FILE macro 19/1919/1
authorGeorge Joseph <george.joseph@fairview5.com>
Tue, 5 Jan 2016 20:52:16 +0000 (13:52 -0700)
committerGeorge Joseph <george.joseph@fairview5.com>
Tue, 5 Jan 2016 22:08:49 +0000 (15:08 -0700)
The 11/13 branches and master use 2 different file version macros. 11/13
uses ASTERISK_FILE_VERSION but master uses ASTERISK_REGISTER_FILE. This
means a new file added to 11/13 can't just be cherry-picked to master
because the macro has to be changed.

To make cherry-picking possible, ASTERISK_REGISTER_FILE was added
to asterisk.h as a simple alias for ASTERISK_FILE_VERSION(__FILE__, NULL)
The "$Revision$" tag doesn't do anything since Asterisk moved to git so
just passing NULL as the verison works fine.  asterisk.h was also
annotated to deprecate ASTERISK_FILE_VERSION and suggest using
ASTERISK_REGISTER_FILE for all new files.

Change-Id: I5867ed898818d26ee49bb6e5c7d4c1a45d4789a5

include/asterisk.h

index 5089e9ce432ed40653ff1b3c06ca288a0c4f0171..ef27717ded178ae63da22c145bfba1904d97637c 100644 (file)
@@ -186,6 +186,9 @@ char *ast_complete_source_filename(const char *partial, int n);
  * SVN from modifying them in this file; under normal circumstances they would
  * not be present and SVN would expand the Revision keyword into the file's
  * revision number.
+ *
+ * \deprecated All new files should use ASTERISK_REGISTER_FILE instead.
+ * \version 11.22.0 deprecated
  */
 #ifdef MTX_PROFILE
 #define        HAVE_MTX_PROFILE        /* used in lock.h */
@@ -215,6 +218,23 @@ char *ast_complete_source_filename(const char *partial, int n);
 #define ASTERISK_FILE_VERSION(file, x)
 #endif /* LOW_MEMORY */
 
+/*!
+ * \since 11.22.0
+ * \brief Register/unregister a source code file with the core.
+ *
+ * This macro will place a file-scope constructor and destructor into the
+ * source of the module using it; this will cause the file to be
+ * registered with the Asterisk core (and unregistered) at the appropriate
+ * times.
+ *
+ * Example:
+ *
+ * \code
+ * ASTERISK_REGISTER_FILE()
+ * \endcode
+ */
+#define ASTERISK_REGISTER_FILE() ASTERISK_FILE_VERSION(__FILE__, NULL)
+
 #if !defined(LOW_MEMORY)
 /*!
  * \brief support for event profiling