@@ -61,11 +61,13 @@ static uint64_t riscv_debug_reg_field_value(riscv_debug_reg_field_info_t field,
6161}
6262
6363static unsigned int riscv_debug_reg_fields_to_s (char * buf , unsigned int offset ,
64- riscv_debug_reg_field_list_t list , riscv_debug_reg_ctx_t context , uint64_t value )
64+ struct riscv_debug_reg_field_list_t (* get_next )(riscv_debug_reg_ctx_t contex ),
65+ riscv_debug_reg_ctx_t context , uint64_t value )
6566{
6667 unsigned int curr = offset ;
6768 curr += get_len_or_sprintf (buf , curr , " { " );
68- for (; list .get_next ; list = list .get_next (context )) {
69+ for (struct riscv_debug_reg_field_list_t list ; get_next ; get_next = list .get_next ) {
70+ list = get_next (context );
6971 curr += riscv_debug_reg_field_to_s (buf , curr , list .field , context ,
7072 riscv_debug_reg_field_value (list .field , value ));
7173 curr += get_len_or_sprintf (buf , curr , ", " );
@@ -85,8 +87,8 @@ unsigned int riscv_debug_reg_to_s(char *buf, enum riscv_debug_reg_ordinal reg_or
8587 length += print_number (buf , length , value );
8688
8789 if (reg .get_fields_head )
88- length += riscv_debug_reg_fields_to_s (buf , length , reg . get_fields_head ( context ),
89- context , value );
90+ length += riscv_debug_reg_fields_to_s (buf , length ,
91+ reg . get_fields_head , context , value );
9092
9193 if (buf )
9294 buf [length ] = '\0' ;
0 commit comments