TutHashCreateStri


Name

TutHashCreateStri — create a hash table with string keys that are not case sensitive

Synopsis

T_HASH_TABLE TutHashCreateStri(init_size) 
T_INT4 init_size; 

Arguments

init_size — the initial size of the hash table

Return Values

Returns a new hash table suitable for string keys that are not case sensitive.

Diagnostics

None

Description

TutHashCreateStri creates a new hash table with string for keys that are not case sensitive. For example, battery1 and BATTERY1 are treated as the same key.

Caution

Providing the initial size that is too small causes the hash table to be resized often as new entries are inserted.

See Also

TutHashCreate, TutHashCreateInt, TutHashCreatePtr, TutHashCreateStr

Examples

This example uses a hash table to look up file pointers from file names:

T_HASH_TABLE hash_table; 
FILE *file; 
 
str_hash_table = TutHashCreateStri(4); 
file = TutFOpen("foo.tmp", "w"); 
if (file != NULL) { 
  TutHashInsert(hash_table, "foo.tmp", file); 
}  
 
/* this will print foo.tmp’s file pointer in hex. */ 
TutOut("The value for foo.tmp is %x.\n", 
        TutHashLookup(hash_table, "foo.tmp")); 
 
/* this will print FOO.TMP’s file pointer in hex (same as foo.tmp). */ 
TutOut("The value for FOO.TMP is %x.\n", 
        TutHashLookup(hash_table, "FOO.TMP")); 
 
/* this will print Foo.Tmp’s file pointer in hex (same as foo.tmp). */ 
TutOut("The value for Foo.Tmp is %x.\n", 
        TutHashLookup(hash_table, "Foo.Tmp")); 

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