diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-04-03 15:45:07 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-04-03 15:45:07 -0700 |
commit | be2a75ec654722b282c9e2fac2b73a4dba9f50d0 (patch) | |
tree | a549280c79cb9611e02ca26eee183076aa2ab563 | |
parent | 93112d07d66cd9ee93ef00527df1da39dfaf7290 (diff) |
Clean up variable scoping in GetFontNames()
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 <alan.coopersmith@oracle.com>
-rw-r--r-- | xfontsel.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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; |