From 04b76488ffead91ad9ccb14707f6d27efe3c4023 Mon Sep 17 00:00:00 2001 From: zhengchao Date: Thu, 5 Jul 2018 17:20:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E9=87=8F=E6=9B=B4=E6=96=B0=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=9C=AA=E9=87=8A=E6=94=BE=E5=86=85=E9=83=A8=E7=9A=84?= =?UTF-8?q?compile=E5=92=8Cgroup=E7=BB=93=E6=9E=84=E4=BD=93=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F=EF=BC=8C?= =?UTF-8?q?=E5=BD=B1=E5=93=8D=E4=B8=BB=E7=89=88=E6=9C=AC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entry/Maat_rule.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index 5f98ba2..d22bf2c 100644 --- a/src/entry/Maat_rule.cpp +++ b/src/entry/Maat_rule.cpp @@ -727,14 +727,8 @@ struct _Maat_group_inner_t* create_group_rule(int group_id) pthread_mutex_init(&(group->mutex), NULL); return group; } -void destroy_group_rule(struct _Maat_group_inner_t* group) +void force_destroy_group_rule(struct _Maat_group_inner_t* group) { - - if(group->ref_cnt>0||group->region_cnt>0) - { - return; - } - dynamic_array_destroy(group->regions,free); group->region_cnt=0; group->region_boundary=0; @@ -748,6 +742,15 @@ void destroy_group_rule(struct _Maat_group_inner_t* group) free(group); } +void destroy_group_rule(struct _Maat_group_inner_t* group) +{ + + if(group->ref_cnt>0||group->region_cnt>0) + { + return; + } + force_destroy_group_rule(group); +} void make_group_set(const struct _Maat_compile_inner_t* compile_rule,universal_bool_expr_t* a_set) { int i=0,j=0; @@ -1069,7 +1072,6 @@ struct _Maat_scanner_t* create_maat_scanner(unsigned int version,_Maat_feather_t MESA_htable_print_crtl(scanner->compile_hash,0); hargs.thread_safe=1; - hargs.data_free=EMPTY_FREE; scanner->group_hash=MESA_htable_create(&hargs, sizeof(hargs)); MESA_htable_print_crtl(scanner->group_hash,0); @@ -1152,8 +1154,8 @@ void destroy_maat_scanner(struct _Maat_scanner_t*scanner) return; } rulescan_destroy(scanner->region); - MESA_htable_destroy(scanner->compile_hash,NULL); - MESA_htable_destroy(scanner->group_hash, NULL); + MESA_htable_destroy(scanner->compile_hash,(void (*)(void*))destroy_compile_rule); + MESA_htable_destroy(scanner->group_hash, (void (*)(void*))force_destroy_group_rule); MESA_htable_destroy(scanner->region_hash, NULL); map_destroy(scanner->district_map); scanner->district_map=NULL; @@ -2636,7 +2638,7 @@ void update_compile_rule(struct _Maat_table_info_t* table,const char* table_line { struct db_compile_rule_t *p_compile=(struct db_compile_rule_t*)calloc(sizeof(struct db_compile_rule_t ),1); struct _head_Maat_rule_t* p_m_rule=&(p_compile->m_rule_head); - char user_region[128*2]={0}; + char user_region[MAX_TABLE_LINE_SIZE]={0}; int ret=0; p_compile->declare_grp_num=0; ret=sscanf(table_line,"%d\t%d\t%hhd\t%hhd\t%hhd\t%lld\t%s\t%d\t%d",&(p_m_rule->config_id)