void daplexcleanup(DAPlexstate** lexstatep) { DAPlexstate* lexstate = *lexstatep; if(lexstate == NULL) return; if(lexstate->input != NULL) ocfree(lexstate->input); if(lexstate->reclaim != NULL) { while(oclistlength(lexstate->reclaim) > 0) { char* word = (char*)oclistpop(lexstate->reclaim); if(word) free(word); } oclistfree(lexstate->reclaim); } ocbytesfree(lexstate->yytext); free(lexstate); *lexstatep = NULL; }
void occlose(OCstate* state) { unsigned int i; if(state == NULL) return; /* Warning: ocfreeroot will attempt to remove the root from state->trees */ /* Ok in this case because we are popping the root out of state->trees */ for(i=0;i<oclistlength(state->trees);i++) { OCnode* root = (OCnode*)oclistpop(state->trees); ocroot_free(root); } oclistfree(state->trees); ocurifree(state->uri); ocbytesfree(state->packet); ocfree(state->error.code); ocfree(state->error.message); ocfree(state->curlflags.useragent); if(state->curlflags.cookiejar) { #if 0 if(state->curlflags.createdflags & COOKIECREATED) unlink(state->curlflags.cookiejar); #endif ocfree(state->curlflags.cookiejar); } if(state->curlflags.netrc != NULL) { #if 0 if(state->curlflags.createdflags & NETRCCREATED) unlink(state->curlflags.netrc); #endif ocfree(state->curlflags.netrc); } ocfree(state->ssl.certificate); ocfree(state->ssl.key); ocfree(state->ssl.keypasswd); ocfree(state->ssl.cainfo); ocfree(state->ssl.capath); ocfree(state->proxy.host); ocfree(state->proxy.userpwd); ocfree(state->creds.userpwd); if(state->curl != NULL) occurlclose(state->curl); ocfree(state); }
Object dap_attrlist(DAPparsestate* state, Object attrlist, Object attrtuple) { OClist* alist = (OClist*)attrlist; if(alist == NULL) alist = oclistnew(); else { char* dupname; if(attrtuple != NULL) {/* NULL=>alias encountered, ignore */ oclistpush(alist,(void*)attrtuple); if((dupname=scopeduplicates(alist))!=NULL) { dap_parse_error(state,"Duplicate attribute names in same scope: %s",dupname); /* Remove this attribute */ oclistpop(alist); state->error = OC_ENAMEINUSE; /* semantic error */ } } } return alist; }
void occlose(OCstate* state) { unsigned int i; if(state == NULL) return; /* Warning: ocfreeroot will attempt to remove the root from state->trees */ /* Ok in this case because we are popping the root out of state->trees */ for(i=0;i<oclistlength(state->trees);i++) { OCnode* root = (OCnode*)oclistpop(state->trees); ocfreeroot(root); } oclistfree(state->trees); ocurifree(state->uri); ocbytesfree(state->packet); ocfree(state->error.code); ocfree(state->error.message); if(state->contentlist != NULL) { struct OCcontent* next; struct OCcontent* curr = state->contentlist; while(curr != NULL) { next = curr->next; ocfree(curr); curr = next; } } ocfree(state->curlflags.useragent); ocfree(state->curlflags.cookiejar); ocfree(state->curlflags.cookiefile); ocfree(state->ssl.certificate); ocfree(state->ssl.key); ocfree(state->ssl.keypasswd); ocfree(state->ssl.cainfo); ocfree(state->ssl.capath); ocfree(state->proxy.host); ocfree(state->creds.username); ocfree(state->creds.password); if(state->curl != NULL) occurlclose(state->curl); ocfree(state); }