Skip to content

Commit 6cd9c16

Browse files
committed
'cppcheck' noted that some variables in the SDL2 port could be more narrowly scoped (part of issue #376).
1 parent 7c5dee1 commit 6cd9c16

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

sdl2/pdcdisp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ static int foregr = -2, backgr = -2; /* current foreground, background */
2828

2929
void PDC_update_rects(void)
3030
{
31-
int i;
32-
3331
if (rectcount)
3432
{
3533
/* if the maximum number of rects has been reached, we're
@@ -41,6 +39,7 @@ void PDC_update_rects(void)
4139
{
4240
int w = pdc_screen->w;
4341
int h = pdc_screen->h;
42+
int i;
4443

4544
for (i = 0; i < rectcount; i++)
4645
{

sdl2/pdcscrn.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,14 @@ void PDC_scr_free(void)
181181

182182
int _get_displaynum(void)
183183
{
184-
SDL_Rect size;
185-
int i, xpos, ypos, displays;
186-
187-
displays = SDL_GetNumVideoDisplays();
184+
const int displays = SDL_GetNumVideoDisplays();
188185

189186
if (displays > 1)
190187
{
191-
SDL_GetGlobalMouseState(&xpos, &ypos);
188+
int i, xpos, ypos;
189+
SDL_Rect size;
192190

191+
SDL_GetGlobalMouseState(&xpos, &ypos);
193192
for (i = 0; i < displays; i++)
194193
{
195194
SDL_GetDisplayBounds(i, &size);

0 commit comments

Comments
 (0)