@@ -79,23 +79,25 @@ static void render_callback(Canvas* const canvas, void* ctx) {
7979 if (minesweeper_state == NULL ) {
8080 return ;
8181 }
82- FuriString * tempStr ;
83- tempStr = furi_string_alloc ();
84- furi_string_printf (tempStr , "Mines: %d" , MINECOUNT - minesweeper_state -> flags_set );
82+ FuriString * mineStr ;
83+ FuriString * timeStr ;
84+ mineStr = furi_string_alloc ();
85+ timeStr = furi_string_alloc ();
86+
87+ furi_string_printf (mineStr , "Mines: %d" , MINECOUNT - minesweeper_state -> flags_set );
8588 canvas_set_font (canvas , FontSecondary );
86- canvas_draw_str_aligned (canvas , 0 , 0 , AlignLeft , AlignTop , furi_string_get_cstr (tempStr ));
87- furi_string_free ( tempStr );
89+ canvas_draw_str_aligned (canvas , 0 , 0 , AlignLeft , AlignTop , furi_string_get_cstr (mineStr ));
90+
8891 int seconds = 0 ;
89- int minutes = 0 ;
92+ int minutes = 0 ;
9093 if (minesweeper_state -> game_started ) {
9194 uint32_t ticks_elapsed = furi_get_tick () - minesweeper_state -> game_started_tick ;
9295 seconds = (int ) ticks_elapsed / furi_kernel_get_tick_frequency ();
9396 minutes = (int ) seconds / 60 ;
9497 seconds = seconds % 60 ;
9598 }
96- furi_string_printf (tempStr , "%01d:%02d" , minutes , seconds );
97- canvas_draw_str_aligned (canvas , 128 , 0 , AlignRight , AlignTop , furi_string_get_cstr (tempStr ));
98- furi_string_free (tempStr );
99+ furi_string_printf (timeStr , "%01d:%02d" , minutes , seconds );
100+ canvas_draw_str_aligned (canvas , 128 , 0 , AlignRight , AlignTop , furi_string_get_cstr (timeStr ));
99101
100102 for (int y = 0 ; y < PLAYFIELD_HEIGHT ; y ++ ) {
101103 for (int x = 0 ; x < PLAYFIELD_WIDTH ; x ++ ) {
@@ -217,7 +219,9 @@ static void render_callback(Canvas* const canvas, void* ctx) {
217219 }
218220 }
219221 }
220- furi_string_free (tempStr );
222+
223+ furi_string_free (mineStr );
224+ furi_string_free (timeStr );
221225 release_mutex ((ValueMutex * )ctx , minesweeper_state );
222226}
223227
0 commit comments