MCPcopy Create free account
hub / github.com/acl-dev/acl / tpl_append_section

Function tpl_append_section

app/wizard/tpllib.cpp:1007–1095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1005
1006
1007int tpl_append_section(tpl_t* tpl)
1008{
1009 if (tpl->tpl != tpl)
1010 {
1011 tpl_tcell_t *curr_sect = tpl->tpl->first;
1012 tpl_node_t *curr_node = tpl->tpl->head;
1013 tpl_node_t *some_node;
1014 int len;
1015 char *buffer;
1016
1017 for (; curr_sect != NULL; curr_sect = curr_sect->next)
1018 {
1019 if (curr_sect->tpl->added_head != NULL)
1020 {
1021
1022 for (len = 0, some_node = curr_node;
1023 some_node != *curr_sect->preceding;
1024 some_node = some_node->next)
1025 {
1026 len += M_NODE_LEN(some_node);
1027 }
1028
1029 *tpl->tpl->added_tail = create_node(len);
1030 buffer = (*tpl->tpl->added_tail)->val;
1031 tpl->tpl->added_tail = &(*tpl->tpl->added_tail)->next;
1032
1033 for (;
1034 curr_node != *curr_sect->preceding;
1035 curr_node = curr_node->next)
1036 {
1037 if (curr_node->val)
1038 {
1039 (void)memcpy(buffer, curr_node->val, curr_node->len);
1040 buffer += curr_node->len;
1041 }
1042 else
1043 {
1044 (void)memcpy(buffer,
1045 curr_node->fval->val,
1046 curr_node->fval->len);
1047 buffer += curr_node->fval->len;
1048 }
1049 }
1050
1051 *buffer = 0;
1052
1053 /* Cut 'n paste added content chain from section */
1054 *tpl->tpl->added_tail = curr_sect->tpl->added_head;
1055 tpl->tpl->added_tail = curr_sect->tpl->added_tail;
1056 curr_sect->tpl->added_tail = &curr_sect->tpl->added_head;
1057 curr_sect->tpl->added_head = NULL;
1058 }
1059 }
1060
1061 for (len = 0, some_node = curr_node;
1062 some_node != NULL;
1063 some_node = some_node->next)
1064 {

Callers

nothing calls this directly

Calls 2

memcpyFunction · 0.85
create_nodeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…