comparison gcc/testsuite/gcc.c-torture/compile/pr52306.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* PR middle-end/52306 */
2
3 struct xmlNs {
4 const unsigned char *prefix;
5 };
6
7 struct xmlNode {
8 const unsigned char *name;
9 struct xmlNs *ns;
10 struct xmlNs *nsDef;
11 };
12
13 struct xsltTemplate {
14 const unsigned char *name;
15 int inheritedNsNr;
16 void *inheritedNs;
17 };
18
19 struct xsltTemplate *xsltNewTemplate(void);
20 void xsltGetQNameURI(unsigned char**);
21 long xmlMalloc(unsigned long);
22 void xsltGenericDebug(void);
23 int xmlStrEqual(const unsigned char*, const unsigned char*);
24
25 static void xsltGetInheritedNsList(
26 struct xsltTemplate *template,
27 struct xmlNode *node)
28 {
29 struct xmlNs *cur;
30 struct xmlNs **ret;
31 int nbns = 0;
32 int maxns = 10;
33 int i;
34
35 if (template == 0
36 || template->inheritedNsNr != 0
37 || template->inheritedNs != 0)
38 return;
39
40 while (node != 0) {
41 cur = node->nsDef;
42 ret = (struct xmlNs**) xmlMalloc((maxns + 1) * sizeof(struct xmlNs*));
43 for (i = 0; i < nbns; i++)
44 if (cur->prefix == ret[i]->prefix
45 || xmlStrEqual(cur->prefix, 0))
46 break;
47
48 if (i >= nbns) {
49 if (nbns >= maxns)
50 return;
51 ret[nbns++] = cur;
52 }
53 }
54 }
55
56 static void
57 xsltParseStylesheetTemplate(struct xmlNode *template)
58 {
59 struct xsltTemplate *ret;
60 unsigned char *prop;
61
62 ret = xsltNewTemplate();
63 if (ret == 0)
64 return;
65 xsltGetInheritedNsList(ret, template);
66 xsltGenericDebug();
67 xsltGetQNameURI(&prop);
68 xmlStrEqual(0, ret->name);
69 }
70
71 void xsltParseStylesheetTop(struct xmlNode *cur)
72 {
73 xmlStrEqual(0, 0);
74
75 while (cur != 0) {
76 if (xmlStrEqual(cur->name, 0))
77 ;
78 else if (xmlStrEqual(cur->name, 0))
79 ;
80 else if (xmlStrEqual(cur->name, 0))
81 xsltParseStylesheetTemplate(cur);
82 }
83 }
84