aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr52306.c
blob: e82cb2a3053f017a922510d421638d342958aa97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* PR middle-end/52306 */

struct xmlNs {
    const unsigned char *prefix;
};

struct xmlNode {
    const unsigned char *name;
    struct xmlNs *ns;
    struct xmlNs *nsDef;
};

struct xsltTemplate {
    const unsigned char *name;
    int inheritedNsNr;
    void *inheritedNs;
};

struct xsltTemplate *xsltNewTemplate(void);
void xsltGetQNameURI(unsigned char**);
long xmlMalloc(unsigned long);
void xsltGenericDebug(void);
int xmlStrEqual(const unsigned char*, const unsigned char*);

static void xsltGetInheritedNsList(
    struct xsltTemplate *template,
    struct xmlNode *node)
{
    struct xmlNs *cur;
    struct xmlNs **ret;
    int nbns = 0;
    int maxns = 10;
    int i;

    if (template == 0
	|| template->inheritedNsNr != 0
	|| template->inheritedNs != 0)
	return;

    while (node != 0) {
	cur = node->nsDef;
	ret = (struct xmlNs**) xmlMalloc((maxns + 1) * sizeof(struct xmlNs*));
	for (i = 0; i < nbns; i++)
	    if (cur->prefix == ret[i]->prefix
		|| xmlStrEqual(cur->prefix, 0))
		break;

	if (i >= nbns) {
	    if (nbns >= maxns)
		return;
	    ret[nbns++] = cur;
	}
    }
}

static void
xsltParseStylesheetTemplate(struct xmlNode *template)
{
    struct xsltTemplate *ret;
    unsigned char *prop;

    ret = xsltNewTemplate();
    if (ret == 0)
	return;
    xsltGetInheritedNsList(ret, template);
    xsltGenericDebug();
    xsltGetQNameURI(&prop);
    xmlStrEqual(0, ret->name);
}

void xsltParseStylesheetTop(struct xmlNode *cur)
{
    xmlStrEqual(0, 0);

    while (cur != 0) {
	if (xmlStrEqual(cur->name, 0))
	    ;
	else if (xmlStrEqual(cur->name, 0))
	    ;
	else if (xmlStrEqual(cur->name, 0))
	    xsltParseStylesheetTemplate(cur);
    }
}