/* Delete the entry. return value = 1 => found and deleted; 0 => param not found */ int ocparamdelete(OClist* params, const char* clientparam) { int i,found = 0; if(params == NULL || clientparam == NULL) return 0; for(i=0;i<oclistlength(params);i+=2) { char* name = (char*)oclistget(params,i); if(strcmp(clientparam,name)==0) {found=1; break;} } if(found) { oclistremove(params,i+1); /* remove value */ oclistremove(params,i); /* remove name */ } return found; }
void ocfreeroot(OCnode* root) { OCtree* tree; OCstate* state; int i; if(root == NULL || root->tree == NULL) return; tree = root->tree; /* Remove the root from the state->trees list */ state = tree->state; for(i=0;i<oclistlength(state->trees);i++) { OCnode* node = (OCnode*)oclistget(state->trees,i); if(root == node) oclistremove(state->trees,i); } /* Note: it is ok if state->trees does not contain this root */ ocfreetree(tree); }