Return-Path: X-Original-To: apmail-apr-commits-archive@www.apache.org Delivered-To: apmail-apr-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C334EFC5A for ; Sun, 24 Mar 2013 15:27:00 +0000 (UTC) Received: (qmail 38270 invoked by uid 500); 24 Mar 2013 15:27:00 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 38234 invoked by uid 500); 24 Mar 2013 15:27:00 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 38227 invoked by uid 99); 24 Mar 2013 15:27:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Mar 2013 15:27:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Mar 2013 15:26:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id AC14C2388962; Sun, 24 Mar 2013 15:26:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1460399 - /apr/apr/trunk/test/sockperf.c Date: Sun, 24 Mar 2013 15:26:39 -0000 To: commits@apr.apache.org From: trawick@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130324152639.AC14C2388962@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: trawick Date: Sun Mar 24 15:26:39 2013 New Revision: 1460399 URL: http://svn.apache.org/r1460399 Log: clean up a bit of error handling just to get rid of sockperf.c: In function 'main': sockperf.c:206:18: warning: variable 'rv' set but not used [-Wunused-but-set-variable] Modified: apr/apr/trunk/test/sockperf.c Modified: apr/apr/trunk/test/sockperf.c URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/sockperf.c?rev=1460399&r1=1460398&r2=1460399&view=diff ============================================================================== --- apr/apr/trunk/test/sockperf.c (original) +++ apr/apr/trunk/test/sockperf.c Sun Mar 24 15:26:39 2013 @@ -96,8 +96,10 @@ static apr_status_t sendRecvBuffer(apr_t rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, APR_PROTO_TCP, pool); - if (rv != APR_SUCCESS) + if (rv != APR_SUCCESS) { + reportError("Unable to create IPv4 stream socket", rv, pool); return rv; + } rv = apr_socket_connect(sock, sockAddr); if (rv != APR_SUCCESS) { @@ -110,16 +112,21 @@ static apr_status_t sendRecvBuffer(apr_t } recvBuf = apr_palloc(pool, size); - if (! recvBuf) + if (! recvBuf) { + reportError("Unable to allocate buffer", ENOMEM, pool); return ENOMEM; + } + *t = 0; /* START! */ testStart = apr_time_now(); rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, APR_PROTO_TCP, pool); - if (rv != APR_SUCCESS) + if (rv != APR_SUCCESS) { + reportError("Unable to create IPv4 stream socket", rv, pool); return rv; + } rv = apr_socket_connect(sock, sockAddr); if (rv != APR_SUCCESS) { @@ -146,8 +153,10 @@ static apr_status_t sendRecvBuffer(apr_t do { len = thistime; rv = apr_socket_recv(sock, &recvBuf[size - thistime], &len); - if (rv != APR_SUCCESS) + if (rv != APR_SUCCESS) { + reportError("Error receiving from socket", rv, pool); break; + } thistime -= len; } while (thistime); } @@ -218,14 +227,18 @@ int main(int argc, char **argv) results = (struct testResult *)apr_pcalloc(pool, sizeof(*results) * nTests); - for(i = 0; i < nTests; i++) { + for (i = 0; i < nTests; i++) { printf("Test -> %c\n", testRuns[i].c); results[i].size = testRuns[i].size * (apr_size_t)TEST_SIZE; rv = runTest(&testRuns[i], &results[i], pool); + if (rv != APR_SUCCESS) { + /* error already reported */ + exit(1); + } } printf("Tests Complete!\n"); - for(i = 0; i < nTests; i++) { + for (i = 0; i < nTests; i++) { int j; apr_time_t totTime = 0; printf("%10d byte block:\n", results[i].size);