Ticket #7901: patch

File patch, 2.1 KB (added by martin@…, 10 years ago)

working patch against 1.52

  • tools/build/v2/engine/hash.c

    old new  
    3434
    3535struct hashhdr
    3636{
    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;
    3848};
    3949
    4050typedef struct item
    static ITEM * hash_search(  
    106116    ITEM * i = *hash_bucket(hp,keyval);
    107117    ITEM * p = 0;
    108118
    109     for ( ; i; i = i->hdr.next )
     119    for ( ; i; i = i->hdr.h.next )
    110120    {
    111121        if ( object_equal( hash_item_key( i ), keydata ) )
    112122        {
    HASHDATA * hash_insert( struct hash * hp  
    153163        if ( hp->items.free )
    154164        {
    155165            i = hp->items.free;
    156             hp->items.free = i->hdr.next;
     166            hp->items.free = i->hdr.h.next;
    157167            assert( hash_item_key( i ) == 0 );
    158168        }
    159169        else
    HASHDATA * hash_insert( struct hash * hp  
    162172            hp->items.next += hp->items.size;
    163173        }
    164174        hp->items.more--;
    165         i->hdr.next = *base;
     175        i->hdr.h.next = *base;
    166176        *base = i;
    167177        *found = 0;
    168178    }
    static void hashrehash( register struct  
    251261            /* code currently assumes rehashing only when there are no free items */
    252262            assert( hash_item_key( i ) != 0 );
    253263
    254             i->hdr.next = *ip;
     264            i->hdr.h.next = *ip;
    255265            *ip = i;
    256266        }
    257267    }
    void hashstats_add( struct hashstats * s  
    367377        {
    368378            ITEM * item;
    369379            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 )
    371381                ++here;
    372382
    373383            count += here;