Re: [gtk-list] RE: glib g_hash_*() using strings as key



/me puts on dunce cap.

> On 10-Mar-2000 Doug Alcorn wrote:
> > Here's the catch:  when I call g_hash_table_lookup(byevent,"some
> > key
> > text") I always get NULL back.  As an ugly hack, I can call
> > g_hash_table_foreach with the key to be looked up perform a strcmp
> > in
> > the callback function and find my event.  This, of course, negates
> > the
> > elegance of a hash.

The problem was that my lookup key _wasn't_ equal to my hash key.  I
was readin in hash keys from a database and forgot to trim off the
padded spaces.
-- 
 (__)  Doug Alcorn          | program == list of computer instructions
 oo /  doug@lathi.net       | firmware == program that is not user modifiable
 |_/   http://www.lathi.net | software == program that a user can modify
       Cincinnati, OH       | "If you don't have the source, it's not software"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]