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

Function parse_xml_file

lib_acl/samples/xml/xml5/xml.cpp:34–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34static int parse_xml_file(const char *filepath)
35{
36 acl_int64 len;
37 ACL_VSTREAM *fp = acl_vstream_fopen(filepath, O_RDWR, 0600, 8192);
38 char *addr;
39 rapidxml::xml_document<> doc;
40
41 if (fp == NULL) {
42 printf("open %s error %s\r\n", filepath, acl_last_serror());
43 return -1;
44 }
45 len = acl_vstream_fsize(fp);
46 if (len <= 0) {
47 printf("fsize %s error %s\r\n", filepath, acl_last_serror());
48 acl_vstream_close(fp);
49 return -1;
50 }
51
52 addr = mmap_addr(ACL_VSTREAM_FILE(fp), (size_t) len);
53 acl_vstream_close(fp);
54 // printf("addr: %s\r\n", addr);
55
56 if (addr == NULL)
57 {
58 printf("mmap_addr error %s\r\n", acl_last_serror());
59 return -1;
60 }
61
62 ACL_METER_TIME("-------------begin--------------");
63 doc.parse<0>(addr);
64 ACL_METER_TIME("-------------end--------------");
65
66 ummap_addr(addr, len);
67
68 printf("Enter any key to continue ...\r\n");
69 getchar();
70
71 return 0;
72}
73
74static void usage(const char *procname)
75{

Callers 1

mainFunction · 0.70

Calls 6

acl_vstream_fopenFunction · 0.85
acl_last_serrorFunction · 0.85
acl_vstream_fsizeFunction · 0.85
acl_vstream_closeFunction · 0.85
mmap_addrFunction · 0.70
ummap_addrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…