comparison PrivateHash.c @ 8:bac20745c52e

Nov 14 Vers -- fixed strcpy to VMS__strDup
author Me
date Sun, 14 Nov 2010 11:13:24 -0800
parents e072db5aa783
children
comparison
equal deleted inserted replaced
4:5de93c6d80b3 7:204118d5a88b
112 hashEntry = getEntryFromTable( key, table ); 112 hashEntry = getEntryFromTable( key, table );
113 if( hashEntry == NULL ) 113 if( hashEntry == NULL )
114 { hashIdx = hashThisKey( key, table->tableSz ); 114 { hashIdx = hashThisKey( key, table->tableSz );
115 hashEntry = (HashEntry*) VMS__malloc( sizeof( HashEntry ) ); 115 hashEntry = (HashEntry*) VMS__malloc( sizeof( HashEntry ) );
116 if( hashEntry == NULL ) return 0; 116 if( hashEntry == NULL ) return 0;
117 hashEntry->key = VMS__malloc( strlen(key) ); 117 hashEntry->key = VMS__strDup( key );
118 if( hashEntry->key == NULL ) return 0;
119 strcpy( hashEntry->key, key );
120 hashEntry->next = (table->entries)[hashIdx]; 118 hashEntry->next = (table->entries)[hashIdx];
121 (table->entries)[hashIdx] = hashEntry; 119 (table->entries)[hashIdx] = hashEntry;
122 table->numEntries += 1; 120 table->numEntries += 1;
123 if( table->tableSz < table->numEntries ) doubleTableSize( table ); 121 if( table->tableSz < table->numEntries ) doubleTableSize( table );
124 } 122 }