libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] tsearch updates from NetBSD source


From: ng0
Subject: [libmicrohttpd] tsearch updates from NetBSD source
Date: Wed, 27 Nov 2019 11:46:59 +0000

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;

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]