MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / append_node

Function append_node

sql/item_xmlfunc.cc:2615–2632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2613
2614
2615static bool
2616append_node(String *str, MY_XML_NODE *node)
2617{
2618 /*
2619 If "str" doesn't have space for a new node,
2620 it will allocate two times more space that it has had so far.
2621 (2*len+512) is a heuristic value,
2622 which gave the best performance during tests.
2623 The ideas behind this formula are:
2624 - It allows to have a very small number of reallocs:
2625 about 10 reallocs on a 1Mb-long XML value.
2626 - At the same time, it avoids excessive memory use.
2627 */
2628 if (str->reserve(sizeof(MY_XML_NODE), 2 * str->length() + 512))
2629 return TRUE;
2630 str->q_append((const char*) node, sizeof(MY_XML_NODE));
2631 return FALSE;
2632}
2633
2634
2635/*

Callers 2

xml_enterFunction · 0.85
xml_valueFunction · 0.85

Calls 3

q_appendMethod · 0.80
reserveMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected