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

Function tpl_set_section_from_file

app/wizard/tpllib.cpp:977–1004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

975}
976
977int tpl_set_section_from_file(tpl_t* tpl, const char* key, const char* filename)
978{
979 int len, status;
980 tpl_node_t *node;
981 FILE *fp = fopen(filename, "rb");
982
983 if (fp == NULL)
984 return TPL_OPEN_ERROR;
985
986 /* Find length of file content */
987 (void)fseek(fp, 0, SEEK_END);
988 len = ftell(fp);
989 (void)rewind(fp);
990
991 node = create_node(len);
992
993 if (fread(node->val, 1, len, fp) < (unsigned)len)
994 status = TPL_READ_ERROR;
995 else
996 status = tpl_set_section_ex(tpl, key, node->val, len, node);
997
998 (void)fclose(fp);
999
1000 if (status != TPL_OK)
1001 destroy_node(node);
1002
1003 return status;
1004}
1005
1006
1007int tpl_append_section(tpl_t* tpl)

Callers

nothing calls this directly

Calls 3

create_nodeFunction · 0.70
tpl_set_section_exFunction · 0.70
destroy_nodeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…