hashtable...squid
- From: "s88" <dave.tw@xxxxxxxxx>
- Date: 30 May 2005 17:45:29 -0700
I work with the bit-vector(http://search.cpan.org/dist/Bit-Vector/)
and squid lib as well. But I meet a weird situation now...Let's see my
code.
I wanna creat a hashtable in a function, and then return the address of
the hashtable.
But my hashtable looks empty outside the fake_table().
The hashtable just manage the pointer I insert. Don't really "copy"
anything into the table.
hashtable *fake_table(){
BitVector_Boot();
N_char x1[] = "101000";
N_char x2[] = "101010";
wordptr X1 = BitVector_Create(6, 1);
wordptr X2 = BitVector_Create(6, 1);
BitVector_from_Bin(X1, x1);
BitVector_from_Bin(X2, x2);
hash_table *inst_table =
hash_create(inst_tb_compare,7951,hash_string);
hash_table *ht2 =
hash_create(inst_tb_compare,7951,hash_string);
inst_tb_atom *_atom1 = (inst_tb_atom
*)malloc(sizeof(inst_tb_atom));
inst_tb_atom *_atom2 = (inst_tb_atom
*)malloc(sizeof(inst_tb_atom));
_atom1->_type = 1;
_atom1->point_to.ht = ht2;
_atom1->X = X1;
_atom2->_type = 1;
_atom2->point_to.ht = ht3;
_atom2->X = X2;
hash_insert(ht2,x2,_atom2);
hash_insert(inst_table,x1,_atom1);
return inst_table;
}
Thanx!!!
.
- Follow-Ups:
- Re: hashtable...squid
- From: Jack Klein
- Re: hashtable...squid
- Prev by Date: Re: Function calls using variables
- Next by Date: Re: sscanf and int64 in Win32 and Unix - different results?
- Previous by thread: typeless data [structures]
- Next by thread: Re: hashtable...squid
- Index(es):