From 686d90745be4417127050ad4b36d0a5403def200 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 10 Apr 2006 15:00:53 +0000 Subject: First curl_multi_socket() commit. Should primarily be considered as an internal code rearrange to fit the future better. --- lib/splay.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 lib/splay.h (limited to 'lib/splay.h') diff --git a/lib/splay.h b/lib/splay.h new file mode 100644 index 000000000..7a6000c18 --- /dev/null +++ b/lib/splay.h @@ -0,0 +1,50 @@ +#ifndef __SPLAY_H +#define __SPLAY_H +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1997 - 2006, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ + +struct Curl_tree { + struct Curl_tree *smaller; /* smaller node */ + struct Curl_tree *larger; /* larger node */ + struct Curl_tree *same; /* points to a node with identical key */ + int key; /* the "sort" key */ + void *payload; /* data the splay code doesn't care about */ +}; + +struct Curl_tree *Curl_splay(int i, struct Curl_tree *t); +struct Curl_tree *Curl_splayinsert(int key, struct Curl_tree *t, + struct Curl_tree *new); +struct Curl_tree *Curl_splayremove(int key, struct Curl_tree *t, + struct Curl_tree **removed); +struct Curl_tree *Curl_splaygetbest(int key, struct Curl_tree *t, + struct Curl_tree **removed); +struct Curl_tree *Curl_splayremovebyaddr(struct Curl_tree *t, + struct Curl_tree *remove); + +#ifdef CURLDEBUG +int Curl_splayprint(struct Curl_tree * t, int d, char output); +#else +#define Curl_splayprint(x,y,z) +#endif + +#endif -- cgit v1.2.1 From 973d63f4f29591b4589013775a9e5536285f0d9c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 27 May 2006 22:26:41 +0000 Subject: one modified proto and one removed proto --- lib/splay.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/splay.h') diff --git a/lib/splay.h b/lib/splay.h index 7a6000c18..092c0b7fe 100644 --- a/lib/splay.h +++ b/lib/splay.h @@ -34,15 +34,19 @@ struct Curl_tree { struct Curl_tree *Curl_splay(int i, struct Curl_tree *t); struct Curl_tree *Curl_splayinsert(int key, struct Curl_tree *t, struct Curl_tree *new); +#if 0 struct Curl_tree *Curl_splayremove(int key, struct Curl_tree *t, struct Curl_tree **removed); +#endif + struct Curl_tree *Curl_splaygetbest(int key, struct Curl_tree *t, struct Curl_tree **removed); -struct Curl_tree *Curl_splayremovebyaddr(struct Curl_tree *t, - struct Curl_tree *remove); +int Curl_splayremovebyaddr(struct Curl_tree *t, + struct Curl_tree *remove, + struct Curl_tree **newroot); #ifdef CURLDEBUG -int Curl_splayprint(struct Curl_tree * t, int d, char output); +void Curl_splayprint(struct Curl_tree * t, int d, char output); #else #define Curl_splayprint(x,y,z) #endif -- cgit v1.2.1 From 3b0a920fad679038eb87ac0df4569d92b4d4f9ea Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 15 Jul 2006 18:57:51 +0000 Subject: don't use 'new' in the proto --- lib/splay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/splay.h') diff --git a/lib/splay.h b/lib/splay.h index 092c0b7fe..16745341e 100644 --- a/lib/splay.h +++ b/lib/splay.h @@ -33,7 +33,7 @@ struct Curl_tree { struct Curl_tree *Curl_splay(int i, struct Curl_tree *t); struct Curl_tree *Curl_splayinsert(int key, struct Curl_tree *t, - struct Curl_tree *new); + struct Curl_tree *newnode); #if 0 struct Curl_tree *Curl_splayremove(int key, struct Curl_tree *t, struct Curl_tree **removed); -- cgit v1.2.1 From 16b95fc77316fdd3866f7de4ebb5d14bd136ac11 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 27 Sep 2007 01:45:22 +0000 Subject: Enabled a few more gcc warnings with --enable-debug. Renamed a few variables to avoid shadowing global declarations. --- lib/splay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/splay.h') diff --git a/lib/splay.h b/lib/splay.h index 16745341e..6e9191a63 100644 --- a/lib/splay.h +++ b/lib/splay.h @@ -42,7 +42,7 @@ struct Curl_tree *Curl_splayremove(int key, struct Curl_tree *t, struct Curl_tree *Curl_splaygetbest(int key, struct Curl_tree *t, struct Curl_tree **removed); int Curl_splayremovebyaddr(struct Curl_tree *t, - struct Curl_tree *remove, + struct Curl_tree *removenode, struct Curl_tree **newroot); #ifdef CURLDEBUG -- cgit v1.2.1 From eb68aa38e3a79ee76967261aeb8c4364223f87d9 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 7 May 2008 15:41:41 +0000 Subject: Christopher Palow provided the patch (edited by me) that introduces the use of microsecond resolution keys for internal splay trees. http://curl.haxx.se/mail/lib-2008-04/0513.html --- lib/splay.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'lib/splay.h') diff --git a/lib/splay.h b/lib/splay.h index 6e9191a63..4e6a8c16d 100644 --- a/lib/splay.h +++ b/lib/splay.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1997 - 2006, Daniel Stenberg, , et al. + * Copyright (C) 1997 - 2008, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -27,24 +27,36 @@ struct Curl_tree { struct Curl_tree *smaller; /* smaller node */ struct Curl_tree *larger; /* larger node */ struct Curl_tree *same; /* points to a node with identical key */ - int key; /* the "sort" key */ + struct timeval key; /* this node's "sort" key */ void *payload; /* data the splay code doesn't care about */ }; -struct Curl_tree *Curl_splay(int i, struct Curl_tree *t); -struct Curl_tree *Curl_splayinsert(int key, struct Curl_tree *t, +struct Curl_tree *Curl_splay(struct timeval i, + struct Curl_tree *t); + +struct Curl_tree *Curl_splayinsert(struct timeval key, + struct Curl_tree *t, struct Curl_tree *newnode); + #if 0 -struct Curl_tree *Curl_splayremove(int key, struct Curl_tree *t, +struct Curl_tree *Curl_splayremove(struct timeval key, + struct Curl_tree *t, struct Curl_tree **removed); #endif -struct Curl_tree *Curl_splaygetbest(int key, struct Curl_tree *t, +struct Curl_tree *Curl_splaygetbest(struct timeval key, + struct Curl_tree *t, struct Curl_tree **removed); + int Curl_splayremovebyaddr(struct Curl_tree *t, struct Curl_tree *removenode, struct Curl_tree **newroot); +#define Curl_splaycomparekeys(i,j) ( ((i.tv_sec) < (j.tv_sec)) ? -1 : \ + ( ((i.tv_sec) > (j.tv_sec)) ? 1 : \ + ( ((i.tv_usec) < (j.tv_usec)) ? -1 : \ + ( ((i.tv_usec) > (j.tv_usec)) ? 1 : 0 )))) + #ifdef CURLDEBUG void Curl_splayprint(struct Curl_tree * t, int d, char output); #else -- cgit v1.2.1 From 2c166812253c28cdfbffdd4de069f5c11db3c7a8 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 10 Jun 2009 02:49:42 +0000 Subject: Adjusted to take in account that... With the curl memory tracking feature decoupled from the debug build feature, CURLDEBUG and DEBUGBUILD preprocessor symbol definitions are used as follows: CURLDEBUG used for curl debug memory tracking specific code (--enable-curldebug) DEBUGBUILD used for debug enabled specific code (--enable-debug) --- lib/splay.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/splay.h') diff --git a/lib/splay.h b/lib/splay.h index 4e6a8c16d..442661d76 100644 --- a/lib/splay.h +++ b/lib/splay.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1997 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1997 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -57,7 +57,7 @@ int Curl_splayremovebyaddr(struct Curl_tree *t, ( ((i.tv_usec) < (j.tv_usec)) ? -1 : \ ( ((i.tv_usec) > (j.tv_usec)) ? 1 : 0 )))) -#ifdef CURLDEBUG +#ifdef DEBUGBUILD void Curl_splayprint(struct Curl_tree * t, int d, char output); #else #define Curl_splayprint(x,y,z) -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/splay.h | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/splay.h') diff --git a/lib/splay.h b/lib/splay.h index 442661d76..832e4e2bb 100644 --- a/lib/splay.h +++ b/lib/splay.h @@ -20,7 +20,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ struct Curl_tree { -- cgit v1.2.1 From 6b75d2c2df7209919a70a29a4479625b62fb3c28 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 3 Sep 2011 16:06:10 +0200 Subject: fix a bunch of MSVC compiler warnings --- lib/splay.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/splay.h') diff --git a/lib/splay.h b/lib/splay.h index 832e4e2bb..49a6dec41 100644 --- a/lib/splay.h +++ b/lib/splay.h @@ -1,5 +1,5 @@ -#ifndef __SPLAY_H -#define __SPLAY_H +#ifndef HEADER_CURL_SPLAY_H +#define HEADER_CURL_SPLAY_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1997 - 2009, Daniel Stenberg, , et al. + * Copyright (C) 1997 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -21,6 +21,7 @@ * KIND, either express or implied. * ***************************************************************************/ +#include "setup.h" struct Curl_tree { struct Curl_tree *smaller; /* smaller node */ @@ -59,7 +60,7 @@ int Curl_splayremovebyaddr(struct Curl_tree *t, #ifdef DEBUGBUILD void Curl_splayprint(struct Curl_tree * t, int d, char output); #else -#define Curl_splayprint(x,y,z) +#define Curl_splayprint(x,y,z) Curl_nop_stmt #endif -#endif +#endif /* HEADER_CURL_SPLAY_H */ -- cgit v1.2.1