void free_data(data_t *in) { if(!in) return; if(delfromlist(in)) { if(in->type == string) free(in->string); if(in->type == symbol) free(in->symbol); if(in->type == pair) free(in->pair); free(in); n_frees++; } else { fprintf(stderr, "-- WARNING: Called free() on unknown pointer.\n"); } }
void lisp_free_data(lisp_data_t *in, lisp_ctx_t *context) { if(!in) return; if(delfromlist(in, context)) { if(in->type == lisp_type_string) free(in->string); if(in->type == lisp_type_symbol) free(in->symbol); if(in->type == lisp_type_error) free(in->error); if(in->type == lisp_type_pair) free(in->pair); free(in); context->n_frees++; } else { fprintf(stderr, "-- WARNING: Called free() on unknown pointer.\n"); } }