| 32 | } |
| 33 | |
| 34 | static 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 | |
| 74 | static void usage(const char *procname) |
| 75 | { |
no test coverage detected
searching dependent graphs…