From 9df1c31ad4870da581f7c094b724bcc7178b9ecf Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 20 Mar 2022 21:35:20 -0700 Subject: [PATCH] lib/glcomp: remove unnecessary 'static' from some variables These are unconditionally overwritten during their respective functions before they are ever read. --- lib/glcomp/glcompfont.c | 3 +-- lib/glcomp/glutils.c | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/glcomp/glcompfont.c b/lib/glcomp/glcompfont.c index b881bc365..5c4a00378 100644 --- a/lib/glcomp/glcompfont.c +++ b/lib/glcomp/glcompfont.c @@ -149,13 +149,12 @@ void glCompDrawText(glCompFont * f,GLfloat x,GLfloat y) /*text rendering functions, depends on a globject to retrieve stats*/ void glCompRenderText(glCompFont * f, glCompObj * parentObj) { - static glCompCommon ref; GLfloat x, y; if (!f->tex) return; x = 0; y = 0; - ref = parentObj->common; + glCompCommon ref = parentObj->common; switch (f->justify.HJustify) { case glFontHJustifyNone: diff --git a/lib/glcomp/glutils.c b/lib/glcomp/glutils.c index 90a22f0f7..4d847be5e 100644 --- a/lib/glcomp/glutils.c +++ b/lib/glcomp/glutils.c @@ -110,7 +110,6 @@ void to3D(int x, int y, GLfloat * X, GLfloat * Y, GLfloat * Z) GLfloat winZ[400]; GLdouble posX, posY, posZ; int idx; - static float comp; glGetDoublev(GL_MODELVIEW_MATRIX, modelview); glGetDoublev(GL_PROJECTION_MATRIX, projection); @@ -121,7 +120,7 @@ void to3D(int x, int y, GLfloat * X, GLfloat * Y, GLfloat * Z) glReadPixels(x - WIDTH / 2, (int) winY - WIDTH / 2, WIDTH, WIDTH, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ); - comp = -9999999; + float comp = -9999999; for (idx = 0; idx < WIDTH * WIDTH; idx++) { if (winZ[idx] > comp && winZ[idx] < 1) comp = winZ[idx]; @@ -322,8 +321,8 @@ void glCompDrawRectangle(glCompRect * r) void glCompDrawRectPrism(glCompPoint * p, GLfloat w, GLfloat h, GLfloat b, GLfloat d, glCompColor * c, int bumped) { - static GLfloat color_fac; - static glCompPoint A, B, C, D, E, F, G, H; + GLfloat color_fac; + glCompPoint A, B, C, D, E, F, G, H; GLfloat dim = 1.00; if (!bumped) { color_fac = (GLfloat) 1.3; -- 2.40.0