Author: poeml
Date: Fri Nov  5 20:14:21 2010
New Revision: 8196

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8196&view=rev
Log:
mod_mirrorbrain:
- optimization in the find_lowest_rank() function which is use to fetch the
  prioritized mirror from an array: return immediately when the size of the
  array is 1.

Modified:
    trunk/mod_mirrorbrain/mod_mirrorbrain.c

Modified: trunk/mod_mirrorbrain/mod_mirrorbrain.c
URL: 
http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mod_mirrorbrain/mod_mirrorbrain.c?rev=8196&r1=8195&r2=8196&view=diff
==============================================================================
--- trunk/mod_mirrorbrain/mod_mirrorbrain.c (original)
+++ trunk/mod_mirrorbrain/mod_mirrorbrain.c Fri Nov  5 20:14:21 2010
@@ -819,6 +819,10 @@
 
 static int find_lowest_rank(apr_array_header_t *arr) 
 {
+    if (arr->nelts == 1) {
+        return 0;
+    }
+
     int i;
     int lowest_id = 0;
     int lowest = INT_MAX;




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
        unsubscribe
to the address mirrorbrain-commits-requ...@mirrorbrain.org

Reply via email to