You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2009/05/14 16:20:47 UTC

svn commit: r774778 - in /httpd/httpd/trunk/modules/mem: mod_plainmem.c mod_sharedmem.c

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 */