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

Function get_variable

external/pugixml/pugixml.cpp:6115–6139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6113 }
6114
6115 xpath_variable* get_variable(xpath_variable_set* set, const char_t* begin, const char_t* end)
6116 {
6117 char_t buffer[32];
6118
6119 size_t length = static_cast<size_t>(end - begin);
6120 char_t* scratch = buffer;
6121
6122 if (length >= sizeof(buffer) / sizeof(buffer[0]))
6123 {
6124 // need to make dummy on-heap copy
6125 scratch = static_cast<char_t*>(global_allocate((length + 1) * sizeof(char_t)));
6126 if (!scratch) return 0;
6127 }
6128
6129 // copy string to zero-terminated buffer and perform lookup
6130 memcpy(scratch, begin, length * sizeof(char_t));
6131 scratch[length] = 0;
6132
6133 xpath_variable* result = set->get(scratch);
6134
6135 // free dummy buffer
6136 if (scratch != buffer) global_deallocate(scratch);
6137
6138 return result;
6139 }
6140}
6141
6142// Internal node set class

Callers 1

Calls 1

getMethod · 0.80

Tested by

no test coverage detected