summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-06-07 13:47:42 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-06-07 14:36:00 +0200
commit2ab48ba5e9d86ac83142c972331c7377059572ee (patch)
treee93913a4193d4ab84af6780daf431ac0091a5bbd
parentf7ee701c612426cb83c7e8e08c75b4b9febed6a3 (diff)
downloadcurl-2ab48ba5e9d86ac83142c972331c7377059572ee.tar.gz
curlx: remove all curlx_tv* functions
... they were not used by the tool anyway. Renamed to Curl_ prefix.
-rw-r--r--lib/connect.c4
-rw-r--r--lib/curlx.h15
-rw-r--r--lib/easy.c12
-rw-r--r--lib/http_proxy.c3
-rw-r--r--lib/multi.c10
-rw-r--r--lib/progress.c2
-rw-r--r--lib/rand.c2
-rw-r--r--lib/select.c12
-rw-r--r--lib/strcase.h4
-rw-r--r--lib/timeval.c14
-rw-r--r--lib/timeval.h19
11 files changed, 37 insertions, 60 deletions
diff --git a/lib/connect.c b/lib/connect.c
index de84daa4f..97d2f1ef4 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -768,7 +768,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
if(rc == 0) { /* no connection yet */
error = 0;
- if(curlx_tvdiff(now, conn->connecttime) >= conn->timeoutms_per_addr) {
+ if(Curl_tvdiff(now, conn->connecttime) >= conn->timeoutms_per_addr) {
infof(data, "After %ldms connect time, move on!\n",
conn->timeoutms_per_addr);
error = ETIMEDOUT;
@@ -776,7 +776,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
/* should we try another protocol family? */
if(i == 0 && conn->tempaddr[1] == NULL &&
- curlx_tvdiff(now, conn->connecttime) >= HAPPY_EYEBALLS_TIMEOUT) {
+ Curl_tvdiff(now, conn->connecttime) >= HAPPY_EYEBALLS_TIMEOUT) {
trynextip(conn, sockindex, 1);
}
}
diff --git a/lib/curlx.h b/lib/curlx.h
index 6168dc119..e2dc7d868 100644
--- a/lib/curlx.h
+++ b/lib/curlx.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 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
@@ -34,24 +34,11 @@
functions while they still are offered publicly. They will be made library-
private one day */
-#include "strcase.h"
-/* "strcase.h" provides the strcasecompare protos */
-
#include "strtoofft.h"
/* "strtoofft.h" provides this function: curlx_strtoofft(), returns a
curl_off_t number from a given string.
*/
-#include "timeval.h"
-/*
- "timeval.h" sets up a 'struct timeval' even for platforms that otherwise
- don't have one and has protos for these functions:
-
- curlx_tvnow()
- curlx_tvdiff()
- curlx_tvdiff_secs()
-*/
-
#include "nonblock.h"
/* "nonblock.h" provides curlx_nonblock() */
diff --git a/lib/easy.c b/lib/easy.c
index 2b1ce9e8a..c3c859294 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -586,12 +586,12 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
}
/* get the time stamp to use to figure out how long poll takes */
- before = curlx_tvnow();
+ before = Curl_tvnow();
/* wait for activity or timeout */
pollrc = Curl_poll(fds, numfds, (int)ev->ms);
- after = curlx_tvnow();
+ after = Curl_tvnow();
ev->msbump = FALSE; /* reset here */
@@ -619,7 +619,7 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
/* If nothing updated the timeout, we decrease it by the spent time.
* If it was updated, it has the new timeout time stored already.
*/
- time_t timediff = curlx_tvdiff(after, before);
+ time_t timediff = Curl_tvdiff(after, before);
if(timediff > 0) {
if(timediff > ev->ms)
ev->ms = 0;
@@ -678,17 +678,17 @@ static CURLcode easy_transfer(struct Curl_multi *multi)
int still_running = 0;
int rc;
- before = curlx_tvnow();
+ before = Curl_tvnow();
mcode = curl_multi_wait(multi, NULL, 0, 1000, &rc);
if(!mcode) {
if(!rc) {
- struct timeval after = curlx_tvnow();
+ struct timeval after = Curl_tvnow();
/* If it returns without any filedescriptor instantly, we need to
avoid busy-looping during periods where it has nothing particular
to wait for */
- if(curlx_tvdiff(after, before) <= 10) {
+ if(Curl_tvdiff(after, before) <= 10) {
without_fds++;
if(without_fds > 2) {
int sleep_ms = without_fds < 10 ? (1 << (without_fds - 1)) : 1000;
diff --git a/lib/http_proxy.c b/lib/http_proxy.c
index 9894e2e5f..b9fe513ff 100644
--- a/lib/http_proxy.c
+++ b/lib/http_proxy.c
@@ -34,7 +34,8 @@
#include "progress.h"
#include "non-ascii.h"
#include "connect.h"
-#include "curlx.h"
+#include "strcase.h"
+#include "strtoofft.h"
#include "vtls/vtls.h"
/* The last 3 #include files should be in this order */
diff --git a/lib/multi.c b/lib/multi.c
index 4b2872743..57e975213 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -2501,7 +2501,7 @@ static CURLMcode add_next_timeout(struct timeval now,
struct curl_llist_element *n = e->next;
time_t diff;
node = (struct time_node *)e->ptr;
- diff = curlx_tvdiff(node->time, now);
+ diff = Curl_tvdiff(node->time, now);
if(diff <= 0)
/* remove outdated entry */
Curl_llist_remove(list, e, NULL);
@@ -2777,7 +2777,7 @@ static CURLMcode multi_timeout(struct Curl_multi *multi,
if(Curl_splaycomparekeys(multi->timetree->key, now) > 0) {
/* some time left before expiration */
- *timeout_ms = (long)curlx_tvdiff(multi->timetree->key, now);
+ *timeout_ms = (long)Curl_tvdiff(multi->timetree->key, now);
if(!*timeout_ms)
/*
* Since we only provide millisecond resolution on the returned value
@@ -2893,7 +2893,7 @@ multi_addtimeout(struct Curl_easy *data,
/* find the correct spot in the list */
for(e = timeoutlist->head; e; e = e->next) {
struct time_node *check = (struct time_node *)e->ptr;
- time_t diff = curlx_tvdiff(check->time, node->time);
+ time_t diff = Curl_tvdiff(check->time, node->time);
if(diff > 0)
break;
prev = e;
@@ -2945,7 +2945,7 @@ void Curl_expire(struct Curl_easy *data, time_t milli, expire_id id)
/* This means that the struct is added as a node in the splay tree.
Compare if the new time is earlier, and only remove-old/add-new if it
is. */
- time_t diff = curlx_tvdiff(set, *nowp);
+ time_t diff = Curl_tvdiff(set, *nowp);
/* remove the previous timer first, if there */
multi_deltimeout(data, id);
@@ -3006,7 +3006,7 @@ void Curl_expire_latest(struct Curl_easy *data, time_t milli, expire_id id)
/* This means that the struct is added as a node in the splay tree.
Compare if the new time is earlier, and only remove-old/add-new if it
is. */
- time_t diff = curlx_tvdiff(set, *expire);
+ time_t diff = Curl_tvdiff(set, *expire);
if((diff > 0) && (diff < milli)) {
/* if the new expire time is later than the top time, skip it, but not
if the diff is larger than the new offset since then the previous
diff --git a/lib/progress.c b/lib/progress.c
index cfaf4049e..8758ebc49 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -361,7 +361,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
now = Curl_tvnow(); /* what time is it */
/* The time spent so far (from the start) */
- data->progress.timespent = curlx_tvdiff_secs(now, data->progress.start);
+ data->progress.timespent = Curl_tvdiff_secs(now, data->progress.start);
timespent = (curl_off_t)data->progress.timespent;
/* The average download speed this far */
diff --git a/lib/rand.c b/lib/rand.c
index b6f40ac0a..eac4e90bf 100644
--- a/lib/rand.c
+++ b/lib/rand.c
@@ -86,7 +86,7 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd)
#endif
if(!seeded) {
- struct timeval now = curlx_tvnow();
+ struct timeval now = Curl_tvnow();
infof(data, "WARNING: Using weak random seed\n");
randseed += (unsigned int)now.tv_usec + (unsigned int)now.tv_sec;
randseed = randseed * 1103515245 + 12345;
diff --git a/lib/select.c b/lib/select.c
index f49314b34..635a2a27a 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -51,7 +51,7 @@
#include "warnless.h"
/* Convenience local macros */
-#define ELAPSED_MS() (int)curlx_tvdiff(curlx_tvnow(), initial_tv)
+#define ELAPSED_MS() (int)Curl_tvdiff(Curl_tvnow(), initial_tv)
int Curl_ack_eintr = 0;
#define ERROR_NOT_EINTR(error) (Curl_ack_eintr || error != EINTR)
@@ -96,7 +96,7 @@ int Curl_wait_ms(int timeout_ms)
Sleep(timeout_ms);
#else
pending_ms = timeout_ms;
- initial_tv = curlx_tvnow();
+ initial_tv = Curl_tvnow();
do {
#if defined(HAVE_POLL_FINE)
r = poll(NULL, 0, pending_ms);
@@ -177,14 +177,14 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
return r;
}
- /* Avoid initial timestamp, avoid curlx_tvnow() call, when elapsed
+ /* Avoid initial timestamp, avoid Curl_tvnow() call, when elapsed
time in this function does not need to be measured. This happens
when function is called with a zero timeout or a negative timeout
value indicating a blocking call should be performed. */
if(timeout_ms > 0) {
pending_ms = (int)timeout_ms;
- initial_tv = curlx_tvnow();
+ initial_tv = Curl_tvnow();
}
#ifdef HAVE_POLL_FINE
@@ -418,14 +418,14 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
return r;
}
- /* Avoid initial timestamp, avoid curlx_tvnow() call, when elapsed
+ /* Avoid initial timestamp, avoid Curl_tvnow() call, when elapsed
time in this function does not need to be measured. This happens
when function is called with a zero timeout or a negative timeout
value indicating a blocking call should be performed. */
if(timeout_ms > 0) {
pending_ms = timeout_ms;
- initial_tv = curlx_tvnow();
+ initial_tv = Curl_tvnow();
}
#ifdef HAVE_POLL_FINE
diff --git a/lib/strcase.h b/lib/strcase.h
index ea2abc8b6..384d402f5 100644
--- a/lib/strcase.h
+++ b/lib/strcase.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 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
@@ -43,7 +43,7 @@ char Curl_raw_toupper(char in);
/* checkprefix() is a shorter version of the above, used when the first
argument is zero-byte terminated */
-#define checkprefix(a,b) curl_strnequal(a,b,strlen(a))
+#define checkprefix(a,b) Curl_strncasecompare(a,b,strlen(a))
void Curl_strntoupper(char *dest, const char *src, size_t n);
char Curl_raw_toupper(char in);
diff --git a/lib/timeval.c b/lib/timeval.c
index bed44c573..f01f71871 100644
--- a/lib/timeval.c
+++ b/lib/timeval.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 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
@@ -48,7 +48,7 @@ struct timeval curlx_tvnow(void)
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)
-struct timeval curlx_tvnow(void)
+struct timeval Curl_tvnow(void)
{
/*
** clock_gettime() is granted to be increased monotonically when the
@@ -82,7 +82,7 @@ struct timeval curlx_tvnow(void)
#elif defined(HAVE_GETTIMEOFDAY)
-struct timeval curlx_tvnow(void)
+struct timeval Curl_tvnow(void)
{
/*
** gettimeofday() is not granted to be increased monotonically, due to
@@ -96,7 +96,7 @@ struct timeval curlx_tvnow(void)
#else
-struct timeval curlx_tvnow(void)
+struct timeval Curl_tvnow(void)
{
/*
** time() returns the value of time in seconds since the Epoch.
@@ -116,7 +116,7 @@ struct timeval curlx_tvnow(void)
* Returns: the time difference in number of milliseconds. For large diffs it
* returns 0x7fffffff on 32bit time_t systems.
*/
-time_t curlx_tvdiff(struct timeval newer, struct timeval older)
+time_t Curl_tvdiff(struct timeval newer, struct timeval older)
{
#if SIZEOF_TIME_T < 8
/* for 32bit time_t systems, add a precaution to avoid overflow for really
@@ -130,11 +130,11 @@ time_t curlx_tvdiff(struct timeval newer, struct timeval older)
}
/*
- * Same as curlx_tvdiff but with full usec resolution.
+ * Same as Curl_tvdiff but with full usec resolution.
*
* Returns: the time difference in seconds with subsecond resolution.
*/
-double curlx_tvdiff_secs(struct timeval newer, struct timeval older)
+double Curl_tvdiff_secs(struct timeval newer, struct timeval older)
{
if(newer.tv_sec != older.tv_sec)
return (double)(newer.tv_sec-older.tv_sec)+
diff --git a/lib/timeval.h b/lib/timeval.h
index 33969354d..24719a061 100644
--- a/lib/timeval.h
+++ b/lib/timeval.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 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
@@ -22,14 +22,9 @@
*
***************************************************************************/
-/*
- * CAUTION: this header is designed to work when included by the app-side
- * as well as the library. Do not mix with library internals!
- */
-
#include "curl_setup.h"
-struct timeval curlx_tvnow(void);
+struct timeval Curl_tvnow(void);
/*
* Make sure that the first argument (t1) is the more recent time and t2 is
@@ -37,20 +32,14 @@ struct timeval curlx_tvnow(void);
*
* Returns: the time difference in number of milliseconds.
*/
-time_t curlx_tvdiff(struct timeval t1, struct timeval t2);
+time_t Curl_tvdiff(struct timeval t1, struct timeval t2);
/*
* Same as curlx_tvdiff but with full usec resolution.
*
* Returns: the time difference in seconds with subsecond resolution.
*/
-double curlx_tvdiff_secs(struct timeval t1, struct timeval t2);
-
-/* These two defines below exist to provide the older API for library
- internals only. */
-#define Curl_tvnow() curlx_tvnow()
-#define Curl_tvdiff(x,y) curlx_tvdiff(x,y)
-#define Curl_tvdiff_secs(x,y) curlx_tvdiff_secs(x,y)
+double Curl_tvdiff_secs(struct timeval t1, struct timeval t2);
#endif /* HEADER_CURL_TIMEVAL_H */