| 190 | // |
| 191 | |
| 192 | void HSH_remove( gpre_sym* symbol) |
| 193 | { |
| 194 | const int h = hash(symbol->sym_string); |
| 195 | |
| 196 | for (gpre_sym** next = &hash_table[h]; *next; next = &(*next)->sym_collision) |
| 197 | { |
| 198 | if (symbol == *next) |
| 199 | { |
| 200 | gpre_sym* homonym = symbol->sym_homonym; |
| 201 | if (homonym) |
| 202 | { |
| 203 | homonym->sym_collision = symbol->sym_collision; |
| 204 | *next = homonym; |
| 205 | } |
| 206 | else { |
| 207 | *next = symbol->sym_collision; |
| 208 | } |
| 209 | return; |
| 210 | } |
| 211 | |
| 212 | for (gpre_sym** ptr = &(*next)->sym_homonym; *ptr; ptr = &(*ptr)->sym_homonym) |
| 213 | { |
| 214 | if (symbol == *ptr) |
| 215 | { |
| 216 | *ptr = symbol->sym_homonym; |
| 217 | return; |
| 218 | } |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | CPR_error("HSH_remove failed"); |
| 223 | } |
| 224 | |
| 225 | |
| 226 | //____________________________________________________________ |
no test coverage detected