Hi, is this okay for merge? I took it from our (NetBSD) tree, compared to what libmicrohttpd contains.
diff --git a/src/lib/tsearch.c b/src/lib/tsearch.c index 78f37608..2d374cad 100644 --- a/src/lib/tsearch.c +++ b/src/lib/tsearch.c @@ -12,6 +12,9 @@ #include "tsearch.h" #include <stdlib.h> +#ifndef __UNCONST +#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) +#endif typedef struct node { @@ -21,7 +24,7 @@ typedef struct node } node_t; -/* $NetBSD: tsearch.c,v 1.5 2005/11/29 03:12:00 christos Exp $ */ +/* $NetBSD: tsearch.c,v 1.7 2012/06/25 22:32:45 abs Exp $ */ /* find or insert datum into search tree */ void * tsearch (const void *vkey, /* key to be located */ @@ -47,10 +50,10 @@ tsearch (const void *vkey, /* key to be located */ } q = malloc (sizeof(node_t)); /* T5: key not found */ - if (q) + if (q != 0) { /* make new node */ *rootp = q; /* link new node to old */ - q->key = vkey; /* initialize new node */ + q->key = __UNCONST(vkey); /* initialize new node */ q->llink = q->rlink = NULL; } return q;
signature.asc
Description: PGP signature