MCPcopy Create free account
hub / github.com/Kitware/VTK / vstateVPush

Function vstateVPush

ThirdParty/libxml2/vtklibxml2/valid.c:311–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309#define RESET_OCCURRENCE ctxt->vstate->occurs &= ((1 << DEPTH) - 1)
310
311static int
312vstateVPush(xmlValidCtxtPtr ctxt, xmlElementContentPtr cont,
313 xmlNodePtr node, unsigned char depth, long occurs,
314 unsigned char state) {
315 int i = ctxt->vstateNr - 1;
316
317 if (ctxt->vstateNr > MAX_RECURSE) {
318 return(-1);
319 }
320 if (ctxt->vstateTab == NULL) {
321 ctxt->vstateMax = 8;
322 ctxt->vstateTab = (xmlValidState *) xmlMalloc(
323 ctxt->vstateMax * sizeof(ctxt->vstateTab[0]));
324 if (ctxt->vstateTab == NULL) {
325 xmlVErrMemory(ctxt);
326 return(-1);
327 }
328 }
329 if (ctxt->vstateNr >= ctxt->vstateMax) {
330 xmlValidState *tmp;
331
332 tmp = (xmlValidState *) xmlRealloc(ctxt->vstateTab,
333 2 * ctxt->vstateMax * sizeof(ctxt->vstateTab[0]));
334 if (tmp == NULL) {
335 xmlVErrMemory(ctxt);
336 return(-1);
337 }
338 ctxt->vstateMax *= 2;
339 ctxt->vstateTab = tmp;
340 ctxt->vstate = &ctxt->vstateTab[0];
341 }
342 /*
343 * Don't push on the stack a state already here
344 */
345 if ((i >= 0) && (ctxt->vstateTab[i].cont == cont) &&
346 (ctxt->vstateTab[i].node == node) &&
347 (ctxt->vstateTab[i].depth == depth) &&
348 (ctxt->vstateTab[i].occurs == occurs) &&
349 (ctxt->vstateTab[i].state == state))
350 return(ctxt->vstateNr);
351 ctxt->vstateTab[ctxt->vstateNr].cont = cont;
352 ctxt->vstateTab[ctxt->vstateNr].node = node;
353 ctxt->vstateTab[ctxt->vstateNr].depth = depth;
354 ctxt->vstateTab[ctxt->vstateNr].occurs = occurs;
355 ctxt->vstateTab[ctxt->vstateNr].state = state;
356 return(ctxt->vstateNr++);
357}
358
359static int
360vstateVPop(xmlValidCtxtPtr ctxt) {

Callers 2

xmlValidateElementTypeFunction · 0.85
xmlValidatePushElementFunction · 0.85

Calls 1

xmlVErrMemoryFunction · 0.85

Tested by

no test coverage detected