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

Function new_xpath_variable

external/pugixml/pugixml.cpp:6047–6061  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6045 }
6046
6047 template <typename T> T* new_xpath_variable(const char_t* name)
6048 {
6049 size_t length = strlength(name);
6050 if (length == 0) return 0; // empty variable names are invalid
6051
6052 // $$ we can't use offsetof(T, name) because T is non-POD, so we just allocate additional length characters
6053 void* memory = global_allocate(sizeof(T) + length * sizeof(char_t));
6054 if (!memory) return 0;
6055
6056 T* result = new (memory) T();
6057
6058 memcpy(result->name, name, (length + 1) * sizeof(char_t));
6059
6060 return result;
6061 }
6062
6063 xpath_variable* new_xpath_variable(xpath_value_type type, const char_t* name)
6064 {

Callers 1

addMethod · 0.85

Calls 1

strlengthFunction · 0.85

Tested by

no test coverage detected