static void destroy(grib_context* context,grib_action* act) { grib_action_if* a = (grib_action_if*) act; grib_action *t = a->block_true; grib_action *f = a->block_false; while(t) { grib_action *nt = t->next; grib_action_delete(context,t); t = nt; } while(f) { grib_action *nf = f->next; grib_action_delete(context,f); f = nf; } grib_expression_free(context,a->expression); grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); }
static void destroy(grib_context* context, grib_action* act) { grib_action_put* a = ( grib_action_put*)act; grib_arguments_free(context, a->args); grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); }
static void destroy(grib_context* context,grib_action* act) { grib_action_write* a = (grib_action_write*) act; grib_context_free_persistent(context, a->name); grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); }
static void destroy(grib_context* context,grib_action* act) { grib_action_set_sarray* a = (grib_action_set_sarray*) act; grib_context_free_persistent(context, a->name); grib_sarray_delete(context,a->sarray); grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); }
static void destroy(grib_context* context,grib_action* act) { grib_action_set* a = (grib_action_set*) act; grib_context_free_persistent(context, a->name); grib_expression_free(context,a->expression); grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); }
/* new GCC compiler v4.5.0 complains function is defined but not used*/ static void grib_rule_entry_delete(grib_context* c,grib_rule_entry* e) { if(e) { grib_context_free_persistent(c,e->name); grib_rule_entry_delete(c,e->next); grib_context_free_persistent(c,e); } }
static void destroy(grib_context* context,grib_action* act) { grib_action_alias* a = (grib_action_alias*)act; if(a->target) grib_context_free_persistent(context, a->target); grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); grib_context_free_persistent(context, act->name_space); }
static void destroy(grib_context* context,grib_action* act) { grib_action_gen* a = ( grib_action_gen*)act; if(a->params != act->default_value) grib_arguments_free(context, a->params); grib_arguments_free(context, act->default_value); grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); grib_context_free_persistent(context, act->name_space); if (act->set) grib_context_free_persistent(context, act->set); }
/* COMEBACK */ static void destroy(grib_context* context,grib_action* act) { grib_action_trigger* a = (grib_action_trigger*)act; grib_action *b = a->block; while(b) { grib_action *n = b->next; grib_action_delete(context,b); b = n; } grib_arguments_free(context, a->trigger_on); grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); }
void grib_context_delete( grib_context* c){ if (!c) c=grib_context_get_default(); grib_hash_keys_delete( c->keys); grib_trie_delete(c->def_files); grib_context_reset( c ); if(c != &default_grib_context) grib_context_free_persistent(&default_grib_context,c); }
static void destroy(grib_context* context,grib_action* act) { grib_action_switch* a = (grib_action_switch*) act; grib_case *t = a->Case; while(t) { grib_case *nt = t->next; grib_action_delete(context,t->action); grib_arguments_free(context,t->values); grib_context_free(context,t); t = nt; } grib_action_delete(context,a->Default); grib_context_free_persistent(context, act->name); grib_context_free_persistent(context, act->op); }
void grib_context_reset(grib_context* c){ if (!c) c=grib_context_get_default(); if(c->grib_reader) { grib_action_file *fr = c->grib_reader->first; grib_action_file *fn = fr; grib_action* a; while(fn){ fr = fn; fn = fn->next; a = fr->root; while(a) { grib_action *na = a->next; grib_free_action(c, a); a = na; } grib_context_free_persistent(c, fr->filename); grib_context_free_persistent(c, fr); } grib_context_free_persistent(c, c->grib_reader); } c->grib_reader = NULL; if(c->codetable) grib_codetable_delete(c); c->codetable = NULL; if(c->grib_definition_files_dir) grib_context_free(c,c->grib_definition_files_dir); if(c->multi_support_on) grib_multi_support_reset(c); }
void grib_codetable_delete(grib_context* c) { grib_codetable* t = c->codetable; while(t) { grib_codetable* s = t->next; int i; for(i = 0; i < t->size; i++) { grib_context_free_persistent(c,t->entries[i].abbreviation); grib_context_free_persistent(c,t->entries[i].title); } grib_context_free_persistent(c,t->filename[0]); if(t->filename[1]) grib_context_free_persistent(c,t->filename[1]); grib_context_free_persistent(c,t->recomposed_name[0]); if (t->recomposed_name[1]) grib_context_free_persistent(c,t->recomposed_name[1]); grib_context_free_persistent(c,t); t = s; } }
static grib_codetable* load_table(grib_accessor_codetable* self) { size_t size = 0; grib_handle* h = ((grib_accessor*)self)->parent->h; grib_context* c = h->context; grib_codetable* t = NULL; grib_codetable* next=NULL ; grib_accessor* a=(grib_accessor*)self; char *filename=0; char name[1024]={0,}; char recomposed[1024]={0,}; char localRecomposed[1024]={0,}; char *localFilename=0; char localName[1024]={0,}; char masterDir[1024]={0,}; char localDir[1024]={0,}; size_t len=1024; if (self->masterDir != NULL) grib_get_string(h,self->masterDir,masterDir,&len); len=1024; if (self->localDir != NULL) grib_get_string(h,self->localDir,localDir,&len); if (*masterDir!=0) { sprintf(name,"%s/%s",masterDir,self->tablename); grib_recompose_name(h, NULL,name, recomposed,0); filename=grib_context_full_path(c,recomposed); } else { grib_recompose_name(h, NULL,self->tablename, recomposed,0); filename=grib_context_full_path(c,recomposed); } if (*localDir!=0) { sprintf(localName,"%s/%s",localDir,self->tablename); grib_recompose_name(h, NULL,localName, localRecomposed,0); localFilename=grib_context_full_path(c,localRecomposed); } next=c->codetable; while(next) { if((filename && next->filename[0] && strcmp(filename,next->filename[0]) == 0) && ((localFilename==0 && next->filename[1]==NULL) || ((localFilename!=0 && next->filename[1]!=NULL) && strcmp(localFilename,next->filename[1]) ==0)) ) return next; next = next->next; } if (a->flags & GRIB_ACCESSOR_FLAG_TRANSIENT) { Assert(a->vvalue!=NULL); size=a->vvalue->length*8; } else { size = grib_byte_count((grib_accessor*)self) * 8; } size = grib_power(size,2); t = (grib_codetable*)grib_context_malloc_clear_persistent(c,sizeof(grib_codetable) + (size-1)*sizeof(code_table_entry)); if (filename!=0) grib_load_codetable(c,filename,recomposed,size,t); if (localFilename!=0) grib_load_codetable(c,localFilename,localRecomposed,size,t); if (t->filename[0]==NULL && t->filename[1]==NULL) { grib_context_free_persistent(c,t); return NULL; } return t; }
static void destroy(grib_context* c,grib_expression* g) { grib_expression_accessor* e = (grib_expression_accessor*)g; grib_context_free_persistent(c,e->name); }
static void destroy(grib_context* c,grib_expression* g) { grib_expression_string* e = (grib_expression_string*)g; grib_context_free_persistent(c,e->value); }