]> granicus.if.org Git - curl/commitdiff
transfer: Code style policing
authorSteve Holme <steve_holme@hotmail.com>
Sun, 30 Nov 2014 14:48:01 +0000 (14:48 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Sun, 30 Nov 2014 15:06:16 +0000 (15:06 +0000)
Prefer ! rather than NULL in if statements, added comments and updated
function spacing, argument spacing and line spacing to be more readble.

lib/transfer.c

index 2cc7f78815604d4cb531a29c4bbf941a4f69add7..a7ab08ecf02b7c470cda37ea205a0deafd480c6b 100644 (file)
@@ -910,13 +910,16 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
          (data->set.prefer_ascii) ||
 #endif
          (data->set.crlf))) {
-        if(data->state.scratch == NULL) {
-          data->state.scratch = malloc(2*BUFSIZE);
-          if(data->state.scratch == NULL) {
-            failf (data, "Failed to alloc scratch buffer!");
+        /* Do we need to allocate a scratch buffer? */
+        if(!data->state.scratch) {
+          data->state.scratch = malloc(2 * BUFSIZE);
+          if(!data->state.scratch) {
+            failf(data, "Failed to alloc scratch buffer!");
+
             return CURLE_OUT_OF_MEMORY;
           }
         }
+
         /*
          * ASCII/EBCDIC Note: This is presumably a text (not binary)
          * transfer so the data should already be in ASCII.