@@ -497,30 +497,19 @@ static int do_map_elem_traverse_dfs_bycnt(map_meta_info *info, map_hash_node *no
497497 int hidx ;
498498 int fcnt = 0 ; /* found count */
499499
500- if (node -> tot_hash_cnt > 0 ) {
501- map_hash_node * child_node ;
502- int rcnt ; /* request count */
503- for (hidx = 0 ; hidx < MAP_HASHTAB_SIZE ; hidx ++ ) {
504- if (node -> hcnt [hidx ] == -1 ) {
505- child_node = (map_hash_node * )node -> htab [hidx ];
506- rcnt = (count > 0 ? (count - fcnt ) : 0 );
507- fcnt += do_map_elem_traverse_dfs_bycnt (info , child_node , rcnt , delete ,
508- (elem_array == NULL ? NULL : & elem_array [fcnt ]), cause );
509- if (delete ) {
510- if (child_node -> tot_hash_cnt == 0 &&
511- child_node -> tot_elem_cnt < (MAP_MAX_HASHCHAIN_SIZE /2 )) {
512- do_map_node_unlink (info , node , hidx );
513- }
500+ for (hidx = 0 ; hidx < MAP_HASHTAB_SIZE ; hidx ++ ) {
501+ if (node -> hcnt [hidx ] == -1 ) {
502+ map_hash_node * child_node = (map_hash_node * )node -> htab [hidx ];
503+ int rcnt = (count > 0 ? (count - fcnt ) : 0 );
504+ fcnt += do_map_elem_traverse_dfs_bycnt (info , child_node , rcnt , delete ,
505+ (elem_array == NULL ? NULL : & elem_array [fcnt ]), cause );
506+ if (delete ) {
507+ if (child_node -> tot_hash_cnt == 0 &&
508+ child_node -> tot_elem_cnt < (MAP_MAX_HASHCHAIN_SIZE /2 )) {
509+ do_map_node_unlink (info , node , hidx );
514510 }
515- if (count > 0 && fcnt >= count )
516- return fcnt ;
517511 }
518- }
519- }
520- assert (count == 0 || fcnt < count );
521-
522- for (hidx = 0 ; hidx < MAP_HASHTAB_SIZE ; hidx ++ ) {
523- if (node -> hcnt [hidx ] > 0 ) {
512+ } else if (node -> hcnt [hidx ] > 0 ) {
524513 map_elem_item * elem = node -> htab [hidx ];
525514 while (elem != NULL ) {
526515 if (elem_array ) {
@@ -532,8 +521,8 @@ static int do_map_elem_traverse_dfs_bycnt(map_meta_info *info, map_hash_node *no
532521 if (count > 0 && fcnt >= count ) break ;
533522 elem = (delete ? node -> htab [hidx ] : elem -> next );
534523 }
535- if (count > 0 && fcnt >= count ) break ;
536524 }
525+ if (count > 0 && fcnt >= count ) break ;
537526 }
538527 return fcnt ;
539528}
0 commit comments