fix function-pointer storage
the C standard says that you're not allowed to cast a function pointer to something else 6.3.2.3 §8: A pointer to a function of one type may be converted to a pointer to a function of another type and back again
This commit is contained in:
@@ -107,7 +107,7 @@ typedef struct _xmpp_handlist_t xmpp_handlist_t;
|
|||||||
struct _xmpp_handlist_t {
|
struct _xmpp_handlist_t {
|
||||||
/* common members */
|
/* common members */
|
||||||
int user_handler;
|
int user_handler;
|
||||||
void *handler;
|
int (*handler)();
|
||||||
void *userdata;
|
void *userdata;
|
||||||
int enabled; /* handlers are added disabled and enabled after the
|
int enabled; /* handlers are added disabled and enabled after the
|
||||||
* handler chain is processed to prevent stanzas from
|
* handler chain is processed to prevent stanzas from
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ static void _timed_handler_add(xmpp_conn_t * const conn,
|
|||||||
|
|
||||||
/* check if handler is already in the list */
|
/* check if handler is already in the list */
|
||||||
for (item = conn->timed_handlers; item; item = item->next) {
|
for (item = conn->timed_handlers; item; item = item->next) {
|
||||||
if (item->handler == (void *)handler && item->userdata == userdata) {
|
if (item->handler == handler && item->userdata == userdata) {
|
||||||
xmpp_warn(conn->ctx, "xmpp", "Timed handler already exists.");
|
xmpp_warn(conn->ctx, "xmpp", "Timed handler already exists.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ static void _timed_handler_add(xmpp_conn_t * const conn,
|
|||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
item->user_handler = user_handler;
|
item->user_handler = user_handler;
|
||||||
item->handler = (void *)handler;
|
item->handler = handler;
|
||||||
item->userdata = userdata;
|
item->userdata = userdata;
|
||||||
item->enabled = 0;
|
item->enabled = 0;
|
||||||
item->next = NULL;
|
item->next = NULL;
|
||||||
@@ -277,7 +277,7 @@ void xmpp_timed_handler_delete(xmpp_conn_t * const conn,
|
|||||||
prev = NULL;
|
prev = NULL;
|
||||||
item = conn->timed_handlers;
|
item = conn->timed_handlers;
|
||||||
while (item) {
|
while (item) {
|
||||||
if (item->handler == (void *)handler) {
|
if (item->handler == handler) {
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = item->next;
|
prev->next = item->next;
|
||||||
else
|
else
|
||||||
@@ -302,7 +302,7 @@ static void _id_handler_add(xmpp_conn_t * const conn,
|
|||||||
/* check if handler is already in the list */
|
/* check if handler is already in the list */
|
||||||
item = (xmpp_handlist_t *)hash_get(conn->id_handlers, id);
|
item = (xmpp_handlist_t *)hash_get(conn->id_handlers, id);
|
||||||
while (item) {
|
while (item) {
|
||||||
if (item->handler == (void *)handler && item->userdata == userdata) {
|
if (item->handler == handler && item->userdata == userdata) {
|
||||||
xmpp_warn(conn->ctx, "xmpp", "Id handler already exists.");
|
xmpp_warn(conn->ctx, "xmpp", "Id handler already exists.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -315,7 +315,7 @@ static void _id_handler_add(xmpp_conn_t * const conn,
|
|||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
item->user_handler = user_handler;
|
item->user_handler = user_handler;
|
||||||
item->handler = (void *)handler;
|
item->handler = handler;
|
||||||
item->userdata = userdata;
|
item->userdata = userdata;
|
||||||
item->enabled = 0;
|
item->enabled = 0;
|
||||||
item->next = NULL;
|
item->next = NULL;
|
||||||
@@ -358,7 +358,7 @@ void xmpp_id_handler_delete(xmpp_conn_t * const conn,
|
|||||||
while (item) {
|
while (item) {
|
||||||
next = item->next;
|
next = item->next;
|
||||||
|
|
||||||
if (item->handler == (void *)handler) {
|
if (item->handler == handler) {
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = next;
|
prev->next = next;
|
||||||
else {
|
else {
|
||||||
@@ -390,7 +390,7 @@ static void _handler_add(xmpp_conn_t * const conn,
|
|||||||
for (item = conn->handlers; item; item = item->next) {
|
for (item = conn->handlers; item; item = item->next) {
|
||||||
/* same handler function can process different stanzas and
|
/* same handler function can process different stanzas and
|
||||||
distinguish them according to userdata. */
|
distinguish them according to userdata. */
|
||||||
if (item->handler == (void *)handler && item->userdata == userdata) {
|
if (item->handler == handler && item->userdata == userdata) {
|
||||||
xmpp_warn(conn->ctx, "xmpp", "Stanza handler already exists.");
|
xmpp_warn(conn->ctx, "xmpp", "Stanza handler already exists.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -402,7 +402,7 @@ static void _handler_add(xmpp_conn_t * const conn,
|
|||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
item->user_handler = user_handler;
|
item->user_handler = user_handler;
|
||||||
item->handler = (void *)handler;
|
item->handler = handler;
|
||||||
item->userdata = userdata;
|
item->userdata = userdata;
|
||||||
item->enabled = 0;
|
item->enabled = 0;
|
||||||
item->next = NULL;
|
item->next = NULL;
|
||||||
@@ -462,7 +462,7 @@ void xmpp_handler_delete(xmpp_conn_t * const conn,
|
|||||||
prev = NULL;
|
prev = NULL;
|
||||||
item = conn->handlers;
|
item = conn->handlers;
|
||||||
while (item) {
|
while (item) {
|
||||||
if (item->handler == (void *)handler) {
|
if (item->handler == handler) {
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = item->next;
|
prev->next = item->next;
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user