]> granicus.if.org Git - curl/commitdiff
non-ascii: Prefer while loop rather than a do loop
authorSteve Holme <steve_holme@hotmail.com>
Fri, 19 Dec 2014 20:38:26 +0000 (20:38 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Sat, 20 Dec 2014 12:47:09 +0000 (12:47 +0000)
This also removes the need to check that the 'form' argument is valid.

lib/non-ascii.c

index ef6a82ceae527903cd94288d7dab81feeb9cf3cb..6c0f9e5a44473cd8e48896234c6af8f1e227ecec 100644 (file)
@@ -319,21 +319,21 @@ CURLcode Curl_convert_form(struct SessionHandle *data, struct FormData *form)
   struct FormData *next;
   CURLcode result;
 
-  if(!form)
-    return CURLE_OK;
-
   if(!data)
     return CURLE_BAD_FUNCTION_ARGUMENT;
 
-  do {
-    next=form->next;  /* the following form line */
+  while(form) {
+    next = form->next;  /* the following form line */
     if(form->type == FORM_DATA) {
       result = Curl_convert_to_network(data, form->line, form->length);
       /* Curl_convert_to_network calls failf if unsuccessful */
       if(result)
         return result;
     }
-  } while((form = next) != NULL); /* continue */
+
+    form = next;
+  }
+
   return CURLE_OK;
 }