| 9327 | } |
| 9328 | |
| 9329 | xpath_variable* xpath_variable_set::add(const char_t* name, xpath_value_type type) |
| 9330 | { |
| 9331 | const size_t hash_size = sizeof(_data) / sizeof(_data[0]); |
| 9332 | size_t hash = hash_string(name) % hash_size; |
| 9333 | |
| 9334 | // look for existing variable |
| 9335 | for (xpath_variable* var = _data[hash]; var; var = var->_next) |
| 9336 | if (strequal(var->name(), name)) |
| 9337 | return var->type() == type ? var : 0; |
| 9338 | |
| 9339 | // add new variable |
| 9340 | xpath_variable* result = new_xpath_variable(type, name); |
| 9341 | |
| 9342 | if (result) |
| 9343 | { |
| 9344 | result->_type = type; |
| 9345 | result->_next = _data[hash]; |
| 9346 | |
| 9347 | _data[hash] = result; |
| 9348 | } |
| 9349 | |
| 9350 | return result; |
| 9351 | } |
| 9352 | |
| 9353 | bool xpath_variable_set::set(const char_t* name, bool value) |
| 9354 | { |
no test coverage detected