mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
pattern: Allocate arrays lazily
This commit is contained in:
parent
7b3d1134c3
commit
307bc230ab
20
pattern.c
20
pattern.c
@ -209,14 +209,8 @@ xmlNewPattern(void) {
|
||||
return(NULL);
|
||||
}
|
||||
memset(cur, 0, sizeof(xmlPattern));
|
||||
cur->maxStep = 10;
|
||||
cur->steps = (xmlStepOpPtr) xmlMalloc(cur->maxStep * sizeof(xmlStepOp));
|
||||
if (cur->steps == NULL) {
|
||||
xmlFree(cur);
|
||||
ERROR(NULL, NULL, NULL,
|
||||
"xmlNewPattern : malloc failed\n");
|
||||
return(NULL);
|
||||
}
|
||||
cur->steps = NULL;
|
||||
cur->maxStep = 0;
|
||||
return(cur);
|
||||
}
|
||||
|
||||
@ -1583,15 +1577,9 @@ xmlNewStreamCtxt(xmlStreamCompPtr stream) {
|
||||
return(NULL);
|
||||
}
|
||||
memset(cur, 0, sizeof(xmlStreamCtxt));
|
||||
cur->states = (int *) xmlMalloc(4 * 2 * sizeof(int));
|
||||
if (cur->states == NULL) {
|
||||
xmlFree(cur);
|
||||
ERROR(NULL, NULL, NULL,
|
||||
"xmlNewStreamCtxt: malloc failed\n");
|
||||
return(NULL);
|
||||
}
|
||||
cur->states = NULL;
|
||||
cur->nbState = 0;
|
||||
cur->maxState = 4;
|
||||
cur->maxState = 0;
|
||||
cur->level = 0;
|
||||
cur->comp = stream;
|
||||
cur->blockLevel = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user