From 568f31aefd6e060779572c1fe593519714f0d50b Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 4 Nov 2023 10:39:54 -0700 Subject: mkfontscale.c: handle -Wshadow warnings from gcc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mkfontscale.c: In function ‘doDirectory’: mkfontscale.c:810:66: warning: declaration of ‘encodingsToDo’ shadows a global declaration [-Wshadow] 810 | doDirectory(const char *dirname_given, int numEncodings, ListPtr encodingsToDo) | ~~~~~~~~^~~~~~~~~~~~~ mkfontscale.c:117:16: note: shadowed declaration is here 117 | static ListPtr encodingsToDo; | ^~~~~~~~~~~~~ mkfontscale.c: In function ‘readEncodings’: mkfontscale.c:1353:23: warning: declaration of ‘encodings’ shadows a global declaration [-Wshadow] 1353 | readEncodings(ListPtr encodings, char *dirname) | ~~~~~~~~^~~~~~~~~ mkfontscale.c:93:21: note: shadowed declaration is here 93 | static ConstListPtr encodings, extra_encodings; | ^~~~~~~~~ Signed-off-by: Alan Coopersmith --- mkfontscale.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mkfontscale.c b/mkfontscale.c index 2b07c67..09599d0 100644 --- a/mkfontscale.c +++ b/mkfontscale.c @@ -104,7 +104,7 @@ static const char *notice_foundry(const char *notice); static const char *vendor_foundry(const signed char *vendor); static int readFontScale(HashTablePtr entries, char *dirname); ListPtr makeXLFD(char *filename, FT_Face face, int); -static int readEncodings(ListPtr encodings, char *dirname); +static int readEncodings(ListPtr *encodingsToDo, char *dirname); static FT_Library ft_library; static float bigEncodingFuzz = 0.02; @@ -114,7 +114,6 @@ static int doScalable; static int doBitmaps; static int doISO10646_1_encoding; static int onlyEncodings; -static ListPtr encodingsToDo; static int reencodeLegacy; static char *encodingPrefix; static char *exclusionSuffix; @@ -144,6 +143,7 @@ main(int argc, char **argv) int argn; FT_Error ftrc; int rc, ll = 0; + ListPtr encodingsToDo; char prefix[NPREFIX]; ProgramName = argv[0]; @@ -213,7 +213,7 @@ main(int argc, char **argv) if (argn >= argc - 1) { missing_arg("-e"); } - rc = readEncodings(encodingsToDo, argv[argn + 1]); + rc = readEncodings(&encodingsToDo, argv[argn + 1]); if (rc < 0) exit(1); argn += 2; @@ -1350,7 +1350,7 @@ vendor_foundry(const signed char *vendor) } static int -readEncodings(ListPtr encodings, char *dirname) +readEncodings(ListPtr *encodingsToDo, char *dirname) { char *fullname; DIR *dirp; @@ -1388,14 +1388,14 @@ readEncodings(ListPtr encodings, char *dirname) closedir(dirp); return -1; } - encodingsToDo = listConsF(encodingsToDo, "%s %s", *name, n); + *encodingsToDo = listConsF(*encodingsToDo, "%s %s", *name, n); free(n); } else { - encodingsToDo = - listConsF(encodingsToDo, "%s %s", *name, fullname); + *encodingsToDo = + listConsF(*encodingsToDo, "%s %s", *name, fullname); } - if (encodingsToDo == NULL) { + if (*encodingsToDo == NULL) { fprintf(stderr, "Couldn't allocate encodings\n"); closedir(dirp); return -1; -- cgit v1.2.3