void destroyList(Food * theList) { Food * tempPtr; Food * currPtr; tempPtr = theList; while (tempPtr != NULL) { currPtr = tempPtr; tempPtr = tempPtr->next; destroyElement(currPtr); free(currPtr); } }
/** * @brief Callback called when the EXIP library has found the end of an element * @param app_data Pointer to the struct appData passed to initParser() * @return EXIP_HANDLER_OK if success, or EXIP_HANDLER_STOP if need to stop the parser */ static errorCode sample_endElement(void* app_data) { struct appData* appD = (struct appData*) app_data; struct element* el; PRINT ("EE\n"); int save = appD->unclosedElement; checkCallback (appD, 1); // libxml2 compatibility : don't call cb_endElement when it is empty if (!save) cb_endElement (appD); appD->depth --; el = pop(&(appD->stack)); destroyElement(el); _XoFreeAttributesWith (&appD->ctxt,free); return ERR_OK; }
static errorCode sample_endElement(void* app_data) { struct appData* appD = (struct appData*) app_data; if(appD->outputFormat == OUT_EXI) printf("EE\n"); else if(appD->outputFormat == OUT_XML) { struct element* el; if(appD->unclosedElement) printf(">\n"); appD->unclosedElement = 0; el = pop(&(appD->stack)); printf("</%s>\n", el->name); destroyElement(el); } return ERR_OK; }