| 174 | } |
| 175 | |
| 176 | static int parse_xml_file(const char *filepath) |
| 177 | { |
| 178 | acl_int64 len; |
| 179 | ACL_VSTREAM *fp = acl_vstream_fopen(filepath, O_RDWR, 0600, 8192); |
| 180 | char *addr; |
| 181 | ACL_XML3 *xml; |
| 182 | |
| 183 | if (fp == NULL) { |
| 184 | printf("open %s error %s\r\n", filepath, acl_last_serror()); |
| 185 | return -1; |
| 186 | } |
| 187 | len = acl_vstream_fsize(fp); |
| 188 | if (len <= 0) { |
| 189 | printf("fsize %s error %s\r\n", filepath, acl_last_serror()); |
| 190 | acl_vstream_close(fp); |
| 191 | return -1; |
| 192 | } |
| 193 | |
| 194 | addr = mmap_addr(ACL_VSTREAM_SOCK(fp), (size_t) len); |
| 195 | if (addr == NULL) |
| 196 | { |
| 197 | printf("mmap_addr error %s\r\n", acl_last_serror()); |
| 198 | acl_vstream_close(fp); |
| 199 | return -1; |
| 200 | } |
| 201 | xml = acl_xml3_alloc(); |
| 202 | |
| 203 | ACL_METER_TIME("-------------begin--------------"); |
| 204 | acl_xml3_update(xml, addr); |
| 205 | ACL_METER_TIME("-------------end--------------"); |
| 206 | |
| 207 | acl_vstream_close(fp); |
| 208 | |
| 209 | if (acl_xml3_is_complete(xml, "root")) |
| 210 | printf("Xml is complete OK, filepath: %s\r\n", filepath); |
| 211 | else |
| 212 | printf("Xml is not complete, filepath: %s\r\n", filepath); |
| 213 | acl_xml3_free(xml); |
| 214 | |
| 215 | ummap_addr(addr, len); |
| 216 | |
| 217 | printf("Enter any key to continue ...\r\n"); |
| 218 | getchar(); |
| 219 | |
| 220 | return 0; |
| 221 | } |
| 222 | |
| 223 | static void walk_xml(ACL_XML3* xml) |
| 224 | { |
no test coverage detected
searching dependent graphs…