summaryrefslogtreecommitdiff
path: root/lib/splay.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-07-28 15:49:36 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-07-28 15:51:25 +0200
commit4dee50b9c80f9b18d2eb9a1c20bd879abb342302 (patch)
tree7a9c5ddd299e23ad27c7efa6a8759ae3122f31c9 /lib/splay.c
parent7551e55d6614cddb039602e08f3d7aa302299617 (diff)
downloadcurl-4dee50b9c80f9b18d2eb9a1c20bd879abb342302.tar.gz
timeval: struct curltime is a struct timeval replacement
... to make all libcurl internals able to use the same data types for the struct members. The timeval struct differs subtly on several platforms so it makes it cumbersome to use everywhere. Ref: #1652 Closes #1693
Diffstat (limited to 'lib/splay.c')
-rw-r--r--lib/splay.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/splay.c b/lib/splay.c
index 1b301f95d..24c6491c5 100644
--- a/lib/splay.c
+++ b/lib/splay.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1997 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1997 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -37,7 +37,7 @@
* Splay using the key i (which may or may not be in the tree.) The starting
* root is t.
*/
-struct Curl_tree *Curl_splay(struct timeval i,
+struct Curl_tree *Curl_splay(struct curltime i,
struct Curl_tree *t)
{
struct Curl_tree N, *l, *r, *y;
@@ -97,11 +97,13 @@ struct Curl_tree *Curl_splay(struct timeval i,
*
* @unittest: 1309
*/
-struct Curl_tree *Curl_splayinsert(struct timeval i,
+struct Curl_tree *Curl_splayinsert(struct curltime i,
struct Curl_tree *t,
struct Curl_tree *node)
{
- static const struct timeval KEY_NOTUSED = {-1, -1}; /* will *NEVER* appear */
+ static const struct curltime KEY_NOTUSED = {
+ -1, -1
+ }; /* will *NEVER* appear */
if(node == NULL)
return t;
@@ -114,7 +116,7 @@ struct Curl_tree *Curl_splayinsert(struct timeval i,
to the end of this list. */
node->key = KEY_NOTUSED; /* we set the key in the sub node to NOTUSED
- to quickly identify this node as a subnode */
+ to quickly identify this node as a subnode */
node->samen = t;
node->samep = t->samep;
t->samep->samen = node;
@@ -149,11 +151,11 @@ struct Curl_tree *Curl_splayinsert(struct timeval i,
/* Finds and deletes the best-fit node from the tree. Return a pointer to the
resulting tree. best-fit means the smallest node if it is not larger than
the key */
-struct Curl_tree *Curl_splaygetbest(struct timeval i,
- struct Curl_tree *t,
- struct Curl_tree **removed)
+struct Curl_tree *Curl_splaygetbest(struct curltime i,
+ struct Curl_tree *t,
+ struct Curl_tree **removed)
{
- static struct timeval tv_zero = {0, 0};
+ static struct curltime tv_zero = {0, 0};
struct Curl_tree *x;
if(!t) {
@@ -209,7 +211,9 @@ int Curl_splayremovebyaddr(struct Curl_tree *t,
struct Curl_tree *removenode,
struct Curl_tree **newroot)
{
- static const struct timeval KEY_NOTUSED = {-1, -1}; /* will *NEVER* appear */
+ static const struct curltime KEY_NOTUSED = {
+ -1, -1
+ }; /* will *NEVER* appear */
struct Curl_tree *x;
if(!t || !removenode)