Changeset 12606
 Timestamp:
 Jul 31, 2011, 2:04:43 PM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/libtransmission/ptrarray.c
r12553 r12606 113 113 **/ 114 114 115 #ifndef NDEBUG116 static int117 lowerBound2( const tr_ptrArray * t,118 const void * ptr,119 int compare( const void *, const void * ),120 bool * exact_match )121 {122 int i;123 const int len = t>n_items;124 125 for( i=0; i<len; ++i )126 {127 const int c = compare( t>items[i], ptr );128 129 if( c == 0 ) {130 *exact_match = true;131 return i;132 }133 134 if( c < 0 )135 continue;136 137 *exact_match = false;138 return i;139 }140 141 *exact_match = false;142 return len;143 }144 #endif145 146 115 int 147 116 tr_ptrArrayLowerBound( const tr_ptrArray * t, … … 152 121 int pos = 1; 153 122 bool match = false; 154 #ifndef NDEBUG155 bool match_2;156 #endif157 123 158 124 if( t>n_items == 0 ) … … 194 160 } 195 161 196 assert( pos == lowerBound2( t, ptr, compare, &match_2 ) );197 assert( match == match_2 );198 199 162 if( exact_match ) 200 163 *exact_match = match; … … 206 169 int compare(const void*, const void*) UNUSED ) 207 170 { 208 #if 1171 #ifndef NDEBUG 209 172 int i; 210 173
Note: See TracChangeset
for help on using the changeset viewer.