Ethereal-dev: [Ethereal-dev] Q: Variables pointing to functions

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Sat, 10 Jan 2004 14:05:33 +0100
I wass getting the following warnings when compiling packet-ldp.c:
packet-ldp.c:591: warning: ISO C forbids assignment between function pointer and `void *'
packet-ldp.c:595: warning: ISO C forbids assignment between function pointer and `void *'
packet-ldp.c:669: warning: ISO C forbids assignment between function pointer and `void *'
packet-ldp.c:673: warning: ISO C forbids assignment between function pointer and `void *'
packet-ldp.c:856: warning: ISO C forbids assignment between function pointer and `void *'
packet-ldp.c:860: warning: ISO C forbids assignment between function pointer and `void *'

As I'm not familiar with variables pointing to functions, can someone
please check whether the following patch is OK?

Thanks
    Jörg


Index: packet-ldp.c
===================================================================
RCS file: /usr/local/cvsroot/ethereal/packet-ldp.c,v
retrieving revision 1.48
diff -p -u -r1.48 packet-ldp.c
--- packet-ldp.c	28 Dec 2003 12:43:38 -0000	1.48
+++ packet-ldp.c	10 Jan 2004 12:51:52 -0000
@@ -555,7 +555,7 @@ dissect_tlv_fec(tvbuff_t *tvb, guint off
 	guint16	family, ix=1, ax;
 	guint8	addr_size=0, *addr, implemented, prefix_len_octets, prefix_len, host_len, vc_len;
 	guint8  intparam_len;
-	void *str_handler=NULL;
+	gchar* (*str_handler) (const guint8 *) = NULL;
 	char *str;
 
 	if (tree) {
@@ -836,7 +836,7 @@ dissect_tlv_address_list(tvbuff_t *tvb, 
 	proto_tree *ti = NULL, *val_tree = NULL;
 	guint16	family, ix;
 	guint8	addr_size, *addr;
-	void *str_handler;
+	gchar* (*str_handler) (const guint8 *);
 	char *str;
 
 	if (tree) {
-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.