================ hashForString return a hash value for the string ================ */
| 1274 | ================ |
| 1275 | */ |
| 1276 | static unsigned hashForString(const char *str) |
| 1277 | { |
| 1278 | int i; |
| 1279 | unsigned hash; |
| 1280 | char letter; |
| 1281 | |
| 1282 | hash = 0; |
| 1283 | i = 0; |
| 1284 | while (str[i] != '\0') |
| 1285 | { |
| 1286 | letter = tolower((unsigned char)str[i]); |
| 1287 | hash += (unsigned)(letter)*(i + 119); |
| 1288 | i++; |
| 1289 | } |
| 1290 | hash &= (HASH_TABLE_SIZE-1); |
| 1291 | return hash; |
| 1292 | } |
| 1293 | |
| 1294 | /* |
| 1295 | ================= |