From 530ed8cb8d62fa92f8952f144547806c08558e03 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sat, 30 Jan 2016 09:22:39 +0100 Subject: [PATCH] Add the MATRIX_API_CALLBACK cast macro --- docs/reference/matrix-glib/matrix-glib-sections.txt | 1 + src/matrix-api.c | 7 +++++++ src/matrix-api.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/docs/reference/matrix-glib/matrix-glib-sections.txt b/docs/reference/matrix-glib/matrix-glib-sections.txt index a5f3280..f3db883 100644 --- a/docs/reference/matrix-glib/matrix-glib-sections.txt +++ b/docs/reference/matrix-glib/matrix-glib-sections.txt @@ -236,6 +236,7 @@ matrix_presence_event_get_type MatrixAPI MatrixAPIInterface MatrixAPICallback +MATRIX_API_CALLBACK MATRIX_API_CALLBACK_PROTO diff --git a/src/matrix-api.c b/src/matrix-api.c index 0d6a088..a5ae187 100644 --- a/src/matrix-api.c +++ b/src/matrix-api.c @@ -120,6 +120,13 @@ * @raw_content will be set. */ +/** + * MATRIX_API_CALLBACK: + * @f: a function pointer + * + * Cast a function pointer to a #MatrixAPICallback. + */ + /** * MATRIX_API_CALLBACK_PROTO: * @name: the name of the function diff --git a/src/matrix-api.h b/src/matrix-api.h index 1bd6f5e..413844f 100644 --- a/src/matrix-api.h +++ b/src/matrix-api.h @@ -41,6 +41,8 @@ typedef void (*MatrixAPICallback)(MatrixAPI *api, gpointer user_data, GError *err); +#define MATRIX_API_CALLBACK(f) ((MatrixAPICallback) (f) + #define MATRIX_API_CALLBACK_PROTO(name) static void \ name (MatrixAPI *api, \ const gchar *content_type, \