void clear_doc_element( doc_element * element ) { doc_element * cur_el; text_line * cur_line; text_line * save; for( cur_el = element; cur_el != NULL; cur_el = cur_el->next ) { switch( cur_el->type ) { case el_binc : case el_dbox : case el_graph : case el_hline : case el_vline : break; // should be nothing to do case el_text : cur_line = cur_el->element.text.first; while( cur_line != NULL ) { add_text_chars_to_pool( cur_line ); save = cur_line->next; add_text_line_to_pool( cur_line ); cur_line = save; } break; default : internal_err( __FILE__, __LINE__ ); } } return; }
void free_some_mem( void ) { if( token_buf != NULL ) { mem_free( token_buf ); } if( alt_ext != NULL ) { mem_free( alt_ext ); } if( def_ext != NULL ) { mem_free( def_ext ); } if( master_fname != NULL ) { mem_free( master_fname ); } if( master_fname_attr != NULL ) { mem_free( master_fname_attr ); } if( dev_name != NULL ) { mem_free( dev_name ); } if( lay_files != NULL ) { laystack * lwk; while( lay_files != NULL ) { lwk = lay_files->next; mem_free( lay_files ); lay_files = lwk; } } if( out_file != NULL ) { mem_free( out_file ); } if( out_file_attr != NULL ) { mem_free( out_file_attr ); } if( global_dict != NULL ) { free_dict( &global_dict ); } if( macro_dict != NULL ) { free_macro_dict( ¯o_dict ); } if( ref_dict != NULL ) { free_ref_dict( &ref_dict ); } if( fig_dict != NULL ) { free_ref_dict( &fig_dict ); } if( fn_dict != NULL ) { free_ref_dict( &fn_dict ); } if( tag_dict != NULL ) { free_tag_dict( &tag_dict ); } if( index_dict != NULL ) { free_index_dict( &index_dict ); } if( buff2 != NULL ) { mem_free( buff2 ); } if( workbuf != NULL ) { mem_free( workbuf ); } if( t_line != NULL ) { add_text_chars_to_pool( t_line ); add_text_line_to_pool( t_line ); } if( t_element != NULL ) { clear_doc_element( t_element ); } if( t_page.top_ban != NULL ) { if( t_page.top_ban->first != NULL ) { clear_doc_element( t_page.top_ban->first ); add_doc_el_to_pool( t_page.top_ban->first ); } add_ban_col_to_pool( t_page.top_ban ); } if( t_page.page_width != NULL ) { clear_doc_element( t_page.page_width ); add_doc_el_to_pool( t_page.page_width ); } if( t_page.main != NULL ) { if( t_page.main->main != NULL ) { clear_doc_element( t_page.main->main ); add_doc_el_to_pool( t_page.main->main ); } if( t_page.main->bot_fig != NULL ) { clear_doc_element( t_page.main->bot_fig ); add_doc_el_to_pool( t_page.main->bot_fig ); } if( t_page.main->footnote != NULL ) { clear_doc_element( t_page.main->footnote ); add_doc_el_to_pool( t_page.main->footnote ); } add_doc_col_to_pool( t_page.main ); } if( t_page.bot_ban != NULL ) { if( t_page.bot_ban->first != NULL ) { clear_doc_element( t_page.bot_ban->first ); add_doc_el_to_pool( t_page.bot_ban->first ); } add_ban_col_to_pool( t_page.bot_ban ); } if( n_page.col_top != NULL ) { clear_doc_element( n_page.col_top ); add_doc_el_to_pool( n_page.col_top ); } if( n_page.col_main != NULL ) { clear_doc_element( n_page.col_main ); add_doc_el_to_pool( n_page.col_main ); } if( n_page.col_bot != NULL ) { clear_doc_element( n_page.col_bot ); add_doc_el_to_pool( n_page.col_bot ); } if( n_page.col_fn != NULL ) { clear_doc_element( n_page.col_fn ); add_doc_el_to_pool( n_page.col_fn ); } free_layout_banner(); free_pool_storage(); }