[mirrorbrain-commits] r8196 - /trunk/mod_mirrorbrain/mod_mirrorbrain.c

From: <poeml_at_mirrorbrain.org>
Date: Fri, 05 Nov 2010 19:14:22 -0000
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
_at_@ -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-request_at_mirrorbrain.org
Received on Fri Nov 05 2010 - 19:14:25 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT