]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
optimize as suggested by chrisd
authorJim Jagielski <jim@apache.org>
Thu, 14 May 2009 14:20:47 +0000 (14:20 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 14 May 2009 14:20:47 +0000 (14:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@774778 13f79535-47bb-0310-9956-ffa450edef68

modules/mem/mod_plainmem.c
modules/mem/mod_sharedmem.c

index af1a3ffa50c08a83344b20c62bc4dc5590db6466..25707027fbc89611d4b330d485a8a665a83375bc 100644 (file)
@@ -63,17 +63,13 @@ static apr_status_t slotmem_create(ap_slotmem_t **new, const char *name, apr_siz
             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 @@ static apr_status_t slotmem_attach(ap_slotmem_t **new, const char *name, apr_siz
         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;
index 902066902049c33432c653d7581a8eed99a87c84..7585f2f9fe485d4393d83d0fc1e3bbd5e8d14f73 100644 (file)
@@ -254,18 +254,13 @@ static apr_status_t slotmem_create(ap_slotmem_t **new, const char *name, apr_siz
         }
 
         /* 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 @@ static apr_status_t slotmem_attach(ap_slotmem_t **new, const char *name, apr_siz
     }
 
     /* 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 */