MCPcopy Create free account
hub / github.com/WheretIB/nullc / add

Method add

external/pugixml/pugixml.cpp:9329–9351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

StartLLVMGenerationFunction · 0.80

Calls 5

hash_stringFunction · 0.85
strequalFunction · 0.85
new_xpath_variableFunction · 0.85
nameMethod · 0.80
typeMethod · 0.45

Tested by

no test coverage detected