Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 63386 invoked from network); 14 May 2009 14:21:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 May 2009 14:21:12 -0000 Received: (qmail 30929 invoked by uid 500); 14 May 2009 14:21:12 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 30847 invoked by uid 500); 14 May 2009 14:21:12 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 30838 invoked by uid 99); 14 May 2009 14:21:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 May 2009 14:21:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Thu, 14 May 2009 14:21:08 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A33452388866; Thu, 14 May 2009 14:20:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r774778 - in /httpd/httpd/trunk/modules/mem: mod_plainmem.c mod_sharedmem.c Date: Thu, 14 May 2009 14:20:47 -0000 To: cvs@httpd.apache.org From: jim@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090514142047.A33452388866@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jim Date: Thu May 14 14:20:47 2009 New Revision: 774778 URL: http://svn.apache.org/viewvc?rev=774778&view=rev Log: optimize as suggested by chrisd Modified: httpd/httpd/trunk/modules/mem/mod_plainmem.c httpd/httpd/trunk/modules/mem/mod_sharedmem.c Modified: httpd/httpd/trunk/modules/mem/mod_plainmem.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mem/mod_plainmem.c?rev=774778&r1=774777&r2=774778&view=diff ============================================================================== --- httpd/httpd/trunk/modules/mem/mod_plainmem.c (original) +++ httpd/httpd/trunk/modules/mem/mod_plainmem.c Thu May 14 14:20:47 2009 @@ -63,17 +63,13 @@ fname = ap_server_root_relative(pool, name); /* first try to attach to existing slotmem */ - if (next) { - for (;;) { - if (strcmp(next->name, fname) == 0) { - /* we already have it */ - *new = next; - return APR_SUCCESS; - } - if (!next->next) - break; - next = next->next; + while (next) { + if (strcmp(next->name, fname) == 0) { + /* we already have it */ + *new = next; + return APR_SUCCESS; } + next = next->next; } } else @@ -114,19 +110,15 @@ return APR_ENOSHMAVAIL; /* first try to attach to existing slotmem */ - if (next) { - for (;;) { - if (strcmp(next->name, fname) == 0) { - /* we already have it */ - *new = next; - *item_size = next->size; - *item_num = next->num; - return APR_SUCCESS; - } - if (!next->next) - break; - next = next->next; + while (next) { + if (strcmp(next->name, fname) == 0) { + /* we already have it */ + *new = next; + *item_size = next->size; + *item_num = next->num; + return APR_SUCCESS; } + next = next->next; } return APR_ENOSHMAVAIL; Modified: httpd/httpd/trunk/modules/mem/mod_sharedmem.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mem/mod_sharedmem.c?rev=774778&r1=774777&r2=774778&view=diff ============================================================================== --- httpd/httpd/trunk/modules/mem/mod_sharedmem.c (original) +++ httpd/httpd/trunk/modules/mem/mod_sharedmem.c Thu May 14 14:20:47 2009 @@ -254,18 +254,13 @@ } /* first try to attach to existing slotmem */ - if (next) { - for (;;) { - if (strcmp(next->name, fname) == 0) { - /* we already have it */ - *new = next; - return APR_SUCCESS; - } - if (!next->next) { - break; - } - next = next->next; + while (next) { + if (strcmp(next->name, fname) == 0) { + /* we already have it */ + *new = next; + return APR_SUCCESS; } + next = next->next; } } else { @@ -375,19 +370,15 @@ } /* first try to attach to existing slotmem */ - if (next) { - for (;;) { - if (strcmp(next->name, fname) == 0) { - /* we already have it */ - *new = next; - *item_size = next->size; - *item_num = next->num; - return APR_SUCCESS; - } - if (!next->next) - break; - next = next->next; + while (next) { + if (strcmp(next->name, fname) == 0) { + /* we already have it */ + *new = next; + *item_size = next->size; + *item_num = next->num; + return APR_SUCCESS; } + next = next->next; } /* first try to attach to existing shared memory */