Add the MATRIX_API_CALLBACK cast macro

This commit is contained in:
Gergely Polonkai 2016-01-30 09:22:39 +01:00
parent 2f366ee30d
commit 530ed8cb8d
3 changed files with 10 additions and 0 deletions

View File

@ -236,6 +236,7 @@ matrix_presence_event_get_type
<TITLE>MatrixAPI</TITLE> <TITLE>MatrixAPI</TITLE>
MatrixAPIInterface MatrixAPIInterface
MatrixAPICallback MatrixAPICallback
MATRIX_API_CALLBACK
MATRIX_API_CALLBACK_PROTO MATRIX_API_CALLBACK_PROTO
<SUBSECTION> <SUBSECTION>

View File

@ -120,6 +120,13 @@
* @raw_content will be set. * @raw_content will be set.
*/ */
/**
* MATRIX_API_CALLBACK:
* @f: a function pointer
*
* Cast a function pointer to a #MatrixAPICallback.
*/
/** /**
* MATRIX_API_CALLBACK_PROTO: * MATRIX_API_CALLBACK_PROTO:
* @name: the name of the function * @name: the name of the function

View File

@ -41,6 +41,8 @@ typedef void (*MatrixAPICallback)(MatrixAPI *api,
gpointer user_data, gpointer user_data,
GError *err); GError *err);
#define MATRIX_API_CALLBACK(f) ((MatrixAPICallback) (f)
#define MATRIX_API_CALLBACK_PROTO(name) static void \ #define MATRIX_API_CALLBACK_PROTO(name) static void \
name (MatrixAPI *api, \ name (MatrixAPI *api, \
const gchar *content_type, \ const gchar *content_type, \