| 2613 | |
| 2614 | |
| 2615 | static bool |
| 2616 | append_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 | /* |