Changeset 0db0df2 in mainline for uspace/app/hbench/env.c
- Timestamp:
- 2025-04-07T17:53:53Z (11 days ago)
- Branches:
- master
- Children:
- 0c6fc7a, 45226285, 93de384
- Parents:
- 8f8818ac
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-07 16:41:57)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-07 17:53:53)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/hbench/env.c
r8f8818ac r0db0df2 34 34 */ 35 35 36 #include <adt/hash.h> 36 37 #include <stdlib.h> 37 38 #include <stdio.h> … … 42 43 ht_link_t link; 43 44 45 size_t hash; 44 46 char *key; 45 47 char *value; … … 49 51 { 50 52 param_t *param = hash_table_get_inst(item, param_t, link); 51 return str_size(param->key);53 return param->hash; 52 54 } 53 55 54 56 static size_t param_key_hash(const void *key) 55 57 { 56 const char *key_str = key; 57 return str_size(key_str); 58 return hash_string(key); 58 59 } 59 60 60 static bool param_key_equal(const void *key, const ht_link_t *item)61 static bool param_key_equal(const void *key, size_t hash, const ht_link_t *item) 61 62 { 62 63 param_t *param = hash_table_get_inst(item, param_t, link); 64 65 if (param->hash != hash) 66 return false; 67 63 68 const char *key_str = key; 64 65 69 return str_cmp(param->key, key_str) == 0; 66 70 } … … 71 75 param_t *b = hash_table_get_inst(link_b, param_t, link); 72 76 73 return str_cmp(a->key, b->key) == 0;77 return a->hash == b->hash && str_cmp(a->key, b->key) == 0; 74 78 } 75 79 … … 116 120 param->key = str_dup(key); 117 121 param->value = str_dup(value); 122 param->hash = hash_string(key); 118 123 119 124 if ((param->key == NULL) || (param->value == NULL)) { … … 132 137 const char *bench_env_param_get(bench_env_t *env, const char *key, const char *default_value) 133 138 { 134 ht_link_t *item = hash_table_find(&env->parameters, (char *)key);139 ht_link_t *item = hash_table_find(&env->parameters, key); 135 140 136 141 if (item == NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.