TutHashLookupBucket


Name

TutHashLookupBucket — look up a bucket in a hash table

Synopsis

T_HASH_BUCKET TutHashLookupBucket(table, key) 
T_HASH_TABLE table; 
T_PTR key; 

Arguments

table — the hash table that should be searched for the bucket

key — key to the bucket

Return Values

The bucket with a given key if successful, NULL otherwise.

Diagnostics

If TutHashLookupBucket fails, it returns NULL and sets the global SmartSockets error number to one of:

Description

TutHashLookupBucket returns the hash bucket that matches a given key. If it cannot find the appropriate bucket, it returns NULL. This function may be used to speed up replacement of values in the table.

Caution

None

See Also

TutHashLookup, TutHashInsert, TutHashBucketSetValue

Examples

This example gets the hash bucket for a key:

T_HASH_TABLE table; 
T_HASH_BUCKET bucket; 
 
table = TutHashCreateStr(20); 
TutHashInsert(table, "EAST", (T_PTR)1); 
/* look up the bucket that contains the entry for "EAST" */ 
bucket = TutHashLookupBucket(table, "EAST"); 
/* replace the value in the bucket */ 
TutHashBucketSetValue(bucket, (T_PTR)2); 

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com