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

Function parse_xml_file

lib_acl/samples/xml/xml1/xml.c:367–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

365}
366
367static void parse_xml_file(const char *filepath, int once)
368{
369 char *data = acl_vstream_loadfile(filepath);
370 ACL_VSTREAM *fp;
371 char *ptr;
372 ACL_XML *xml;
373 struct timeval begin, end;
374
375 if (data == NULL)
376 return;
377
378 gettimeofday(&begin, NULL);
379
380 /* ���� xml ���� */
381 xml = acl_xml_alloc();
382
383 ptr = data;
384
385 if (once) {
386 /* һ���Եط������� xml ���� */
387 acl_xml_parse(xml, ptr);
388 } else {
389 /* ÿ�ν�����һ���ֽ������� xml ���� */
390 while (*ptr) {
391 char ch2[2];
392
393 ch2[0] = *ptr;
394 ch2[1] = 0;
395 acl_xml_parse(xml, ch2);
396 ptr++;
397 }
398 }
399
400 gettimeofday(&end, NULL);
401
402 printf("------ok, time: %ld seconds, %ld microseconds -------\r\n",
403 (long) end.tv_sec - (long) begin.tv_sec,
404 (long) end.tv_usec - (long) begin.tv_usec);
405
406
407 fp = acl_vstream_fopen("dump.txt", O_RDWR | O_CREAT | O_TRUNC, 0600, 4096);
408
409 /* �� xml ����ת����ָ������ */
410 acl_xml_dump(xml, fp);
411
412 acl_vstream_fclose(fp);
413 acl_xml_free(xml);
414 acl_myfree(data);
415}
416
417static void build_xml2(void)
418{

Callers 1

mainFunction · 0.70

Calls 6

acl_vstream_loadfileFunction · 0.85
acl_xml_allocFunction · 0.85
acl_vstream_fopenFunction · 0.85
acl_xml_dumpFunction · 0.85
acl_xml_freeFunction · 0.85
gettimeofdayFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…