Ticket #7901: patch
File patch, 2.1 KB (added by , 10 years ago) |
---|
-
tools/build/v2/engine/hash.c
old new 34 34 35 35 struct hashhdr 36 36 { 37 struct item * next; 37 union { 38 struct item * next; 39 /* 40 * Some architectures have 32bit pointers but 64bit time_t (as used 41 * in file_info_t), and require natural alignement of data. 42 * Since we offset an aligned pointer by sizeof(hashhdr) in 43 * hash_item_data(item), we may cause misalignement if we do not 44 * make sure that sizeof(hashhdr) is properly aligned. 45 */ 46 time_t aligner; /* unused dummy for alignement */ 47 } h; 38 48 }; 39 49 40 50 typedef struct item … … static ITEM * hash_search( 106 116 ITEM * i = *hash_bucket(hp,keyval); 107 117 ITEM * p = 0; 108 118 109 for ( ; i; i = i->hdr. next )119 for ( ; i; i = i->hdr.h.next ) 110 120 { 111 121 if ( object_equal( hash_item_key( i ), keydata ) ) 112 122 { … … HASHDATA * hash_insert( struct hash * hp 153 163 if ( hp->items.free ) 154 164 { 155 165 i = hp->items.free; 156 hp->items.free = i->hdr. next;166 hp->items.free = i->hdr.h.next; 157 167 assert( hash_item_key( i ) == 0 ); 158 168 } 159 169 else … … HASHDATA * hash_insert( struct hash * hp 162 172 hp->items.next += hp->items.size; 163 173 } 164 174 hp->items.more--; 165 i->hdr. next = *base;175 i->hdr.h.next = *base; 166 176 *base = i; 167 177 *found = 0; 168 178 } … … static void hashrehash( register struct 251 261 /* code currently assumes rehashing only when there are no free items */ 252 262 assert( hash_item_key( i ) != 0 ); 253 263 254 i->hdr. next = *ip;264 i->hdr.h.next = *ip; 255 265 *ip = i; 256 266 } 257 267 } … … void hashstats_add( struct hashstats * s 367 377 { 368 378 ITEM * item; 369 379 int here = 0; 370 for ( item = tab[ i ]; item != 0; item = item->hdr. next )380 for ( item = tab[ i ]; item != 0; item = item->hdr.h.next ) 371 381 ++here; 372 382 373 383 count += here;