示例#1
0
文件: lexer.c 项目: chyyuu/recc
void destroy_c_lexer_state(struct c_lexer_state * c_lexer_state){
	unsigned int num_tokens = struct_c_lexer_token_ptr_list_size(&c_lexer_state->tokens);
	struct c_lexer_token ** tokens = struct_c_lexer_token_ptr_list_data(&c_lexer_state->tokens);
	unsigned int i;
	for(i = 0; i < num_tokens; i++){
		struct_c_lexer_token_memory_pool_free(c_lexer_state->c.memory_pool_collection->struct_c_lexer_token_pool, tokens[i]);
	}
	struct_c_lexer_token_ptr_list_destroy(&c_lexer_state->tokens);
}
示例#2
0
文件: lexer.c 项目: ezhangle/recc
void destroy_c_lexer_state(struct c_lexer_state * c_lexer_state){
	unsigned int num_tokens = struct_c_lexer_token_ptr_list_size(&c_lexer_state->tokens);
	struct c_lexer_token ** tokens = struct_c_lexer_token_ptr_list_data(&c_lexer_state->tokens);
	unsigned int i;
	struct memory_pooler * c_lexer_token_pool = memory_pooler_collection_get_pool(c_lexer_state->c.memory_pooler_collection, sizeof(struct c_lexer_token));
	for(i = 0; i < num_tokens; i++){
		memory_pooler_free(c_lexer_token_pool, tokens[i]);
	}
	struct_c_lexer_token_ptr_list_destroy(&c_lexer_state->tokens);
}