]> granicus.if.org Git - curl/commitdiff
Curl_pp_readresp: replace stupid loop with memcpy
authorDaniel Stenberg <daniel@haxx.se>
Sat, 21 Dec 2013 23:29:43 +0000 (00:29 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 21 Dec 2013 23:29:43 +0000 (00:29 +0100)
lib/pingpong.c

index 1b2ccd9b57010351db183f829952a8a9cb8a9cdd..eca385e489b86a690f7da0cbe8d6f66a1fb0b4f5 100644 (file)
@@ -376,10 +376,8 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd,
           if(pp->endofresp(conn, pp->linestart_resp, perline, code)) {
             /* This is the end of the last line, copy the last line to the
                start of the buffer and zero terminate, for old times sake */
-            char *meow;
-            int n;
-            for(meow=pp->linestart_resp, n=0; meow<ptr; meow++, n++)
-              buf[n] = *meow;
+            size_t n = ptr - pp->linestart_resp;
+            memcpy(buf, pp->linestart_resp, n);
             buf[n]=0; /* zero terminate */
             keepon=FALSE;
             pp->linestart_resp = ptr+1; /* advance pointer */