aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/hostip.c8
-rw-r--r--lib/http.c13
-rw-r--r--lib/transfer.c7
-rw-r--r--lib/url.c6
4 files changed, 19 insertions, 15 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 95029e6b2..cee5bc2d8 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -163,9 +163,11 @@ void Curl_global_host_cache_dtor(void)
*/
int Curl_num_addresses(const Curl_addrinfo *addr)
{
- int i;
- for (i = 0; addr; addr = addr->ai_next, i++)
- ; /* empty loop */
+ int i = 0;
+ while(addr) {
+ addr = addr->ai_next;
+ i++;
+ }
return i;
}
diff --git a/lib/http.c b/lib/http.c
index 95ba8d0db..dd12e964a 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -203,10 +203,9 @@ char *Curl_copy_header_value(const char *h)
++h;
/* Find the first non-space letter */
- for(start=h;
- *start && ISSPACE(*start);
- start++)
- ; /* empty loop */
+ start = h;
+ while(*start && ISSPACE(*start))
+ start++;
/* data is in the host encoding so
use '\r' and '\n' instead of 0x0d and 0x0a */
@@ -215,10 +214,12 @@ char *Curl_copy_header_value(const char *h)
end = strchr(start, '\n');
if(!end)
end = strchr(start, '\0');
+ if(!end)
+ return NULL;
/* skip all trailing space letters */
- for(; ISSPACE(*end) && (end > start); end--)
- ; /* empty loop */
+ while((end > start) && ISSPACE(*end))
+ end--;
/* get length of the type */
len = end-start+1;
diff --git a/lib/transfer.c b/lib/transfer.c
index f15d9a0f2..fe0cded50 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1255,10 +1255,9 @@ static CURLcode readwrite_headers(struct SessionHandle *data,
char *start;
/* Find the first non-space letter */
- for(start=k->p+17;
- *start && ISSPACE(*start);
- start++)
- ; /* empty loop */
+ start = k->p + 17;
+ while(*start && ISSPACE(*start))
+ start++;
/* Record the content-encoding for later use */
if(checkprefix("identity", start))
diff --git a/lib/url.c b/lib/url.c
index 73b396863..bf2327589 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -231,8 +231,10 @@ void Curl_safefree(void *ptr)
static void close_connections(struct SessionHandle *data)
{
/* Loop through all open connections and kill them one by one */
- while(-1 != ConnectionKillOne(data))
- ; /* empty loop */
+ long i;
+ do {
+ i = ConnectionKillOne(data);
+ while(i != -1L);
}
void Curl_freeset(struct SessionHandle * data)