From be2a75ec654722b282c9e2fac2b73a4dba9f50d0 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 3 Apr 2022 15:45:07 -0700 Subject: Clean up variable scoping in GetFontNames() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gets rid of gcc warning: xfontsel.c: In function ‘GetFontNames’: xfontsel.c:498:16: warning: declaration of ‘f’ shadows a previous local [-Wshadow] int maxField, f; ^ xfontsel.c:446:9: note: shadowed declaration is here int f, field, count; ^ Signed-off-by: Alan Coopersmith --- xfontsel.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xfontsel.c b/xfontsel.c index 24a9745..7c12b20 100644 --- a/xfontsel.c +++ b/xfontsel.c @@ -443,17 +443,21 @@ void GetFontNames(XtPointer closure) { Display *dpy = (Display*)closure; ParseRec *parseRec; - int f, field, count; + int count; char **fontNames; - Boolean *b; int work_priority = 0; fontNames = XListFonts(dpy, AppRes.pattern, 32767, &numFonts); fonts = (FontValues*)XtMalloc( numFonts*sizeof(FontValues) ); fontInSet = (Boolean*)XtMalloc( numFonts*sizeof(Boolean) ); - for (f = numFonts, b = fontInSet; f; f--, b++) *b = True; - for (field = 0; field < FIELD_COUNT; field++) { + { + int f; + Boolean *b; + for (f = numFonts, b = fontInSet; f; f--, b++) + *b = True; + } + for (int field = 0; field < FIELD_COUNT; field++) { fieldValues[field] = (FieldValueList*)XtMalloc(sizeof(FieldValueList)); fieldValues[field]->allocated = 1; fieldValues[field]->count = 0; -- cgit v1.2.3