gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r36336 - libmicrohttpd/src/microhttpd


From: gnunet
Subject: [GNUnet-SVN] r36336 - libmicrohttpd/src/microhttpd
Date: Sun, 6 Sep 2015 18:01:56 +0200

Author: Karlson2k
Date: 2015-09-06 18:01:56 +0200 (Sun, 06 Sep 2015)
New Revision: 36336

Modified:
   libmicrohttpd/src/microhttpd/tsearch.c
   libmicrohttpd/src/microhttpd/tsearch.h
Log:
Update built-in tsearch replacement

Modified: libmicrohttpd/src/microhttpd/tsearch.c
===================================================================
--- libmicrohttpd/src/microhttpd/tsearch.c      2015-09-06 16:01:53 UTC (rev 
36335)
+++ libmicrohttpd/src/microhttpd/tsearch.c      2015-09-06 16:01:56 UTC (rev 
36336)
@@ -1,5 +1,3 @@
-/*     $NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $        */
-
 /*
  * Tree search generalized from Knuth (6.2.2) Algorithm T just like
  * the AT&T man page says.
@@ -11,19 +9,20 @@
  * Totally public domain.
  */
 
-#ifndef _MSC_FULL_VER
-#include <sys/cdefs.h>
-#endif /*! _MSC_FULL_VER */
-#define _SEARCH_PRIVATE
 #include "tsearch.h"
 #include <stdlib.h>
 
+typedef        struct node {
+  const void   *key;
+  struct node  *llink, *rlink;
+} node_t;
+
+/*     $NetBSD: tsearch.c,v 1.5 2005/11/29 03:12:00 christos Exp $     */
 /* find or insert datum into search tree */
 void *
-tsearch(vkey, vrootp, compar)
-       const void *vkey;               /* key to be located */
-       void **vrootp;                  /* address of tree root */
-       int (*compar)(const void *, const void *);
+tsearch(const void *vkey,              /* key to be located */
+       void **vrootp,                  /* address of tree root */
+       int (*compar)(const void *, const void *))
 {
        node_t *q;
        node_t **rootp = (node_t **)vrootp;
@@ -43,23 +42,22 @@
        }
 
        q = malloc(sizeof(node_t));             /* T5: key not found */
-       if (q != 0) {                           /* make new node */
+       if (q) {                                /* make new node */
                *rootp = q;                     /* link new node to old */
-               /* LINTED const castaway ok */
-               q->key = (void *)vkey;          /* initialize new node */
+               q->key = vkey;          /* initialize new node */
                q->llink = q->rlink = NULL;
        }
        return q;
 }
 
-/* find a node, or return 0 */
+/*     $NetBSD: tfind.c,v 1.5 2005/03/23 08:16:53 kleink Exp $ */
+/* find a node, or return NULL */
 void *
-tfind(vkey, vrootp, compar)
-       const void *vkey;               /* key to be found */
-       void * const *vrootp;           /* address of the tree root */
-       int (*compar)(const void *, const void *);
+tfind(const void *vkey,         /* key to be found */
+      void * const *vrootp,     /* address of the tree root */
+      int (*compar)(const void *, const void *))
 {
-       node_t **rootp = (node_t **)vrootp;
+       node_t * const *rootp = (node_t * const*)vrootp;
 
        if (rootp == NULL)
                return NULL;
@@ -76,6 +74,7 @@
        return NULL;
 }
 
+/*     $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $        */
 /*
  * delete node with given key
  *

Modified: libmicrohttpd/src/microhttpd/tsearch.h
===================================================================
--- libmicrohttpd/src/microhttpd/tsearch.h      2015-09-06 16:01:53 UTC (rev 
36335)
+++ libmicrohttpd/src/microhttpd/tsearch.h      2015-09-06 16:01:56 UTC (rev 
36336)
@@ -6,45 +6,19 @@
  * $FreeBSD: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert 
$
  */
 
-#ifndef _SEARCH_H_
-#define _SEARCH_H_
+#ifndef _TSEARCH_H_
+#define _TSEARCH_H_
 
-#ifndef _MSC_FULL_VER
-#include <sys/cdefs.h>
-#endif  /* _MSC_FULL_VER */
-#if !defined(__BEGIN_DECLS) || !defined(__END_DECLS)
 #if defined(__cplusplus)
-#define        __BEGIN_DECLS   extern "C" {
-#define        __END_DECLS     };
-#else  /* !__cplusplus */
-#define        __BEGIN_DECLS
-#define        __END_DECLS
-#endif /* !__cplusplus */
-#endif /* !__BEGIN_DECLS || !__END_DECLS */
-#include <sys/types.h>
-
-typedef        enum {
-       preorder,
-       postorder,
-       endorder,
-       leaf
-} VISIT;
-
-#ifdef _SEARCH_PRIVATE
-typedef        struct node {
-       char         *key;
-       struct node  *llink, *rlink;
-} node_t;
-#endif
-
-__BEGIN_DECLS
+extern "C" {
+#endif /* __cplusplus */
 void   *tdelete(const void * __restrict, void ** __restrict,
            int (*)(const void *, const void *));
 void   *tfind(const void *, void * const *,
            int (*)(const void *, const void *));
 void   *tsearch(const void *, void **, int (*)(const void *, const void *));
-void    twalk(const void *, void (*)(const void *, VISIT, int));
-void    tdestroy(void *, void (*)(void *));
-__END_DECLS
+#if defined(__cplusplus)
+};
+#endif /* __cplusplus */
 
-#endif /* !_SEARCH_H_ */
+#endif /* !_TSEARCH_H_ */




reply via email to

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