From d65d3e5a4e9083feb8074c9dceec7ef13baf769f Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Wed, 4 Oct 2023 06:48:59 +0000 Subject: Fix gcc unused var warning --- generic/tclZipfs.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index ffa46d6..f04614a 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -5448,8 +5448,6 @@ ZipFSMatchInDirectoryProc( const char *pattern, /* What names we are looking for. */ Tcl_GlobTypeData *types) /* What types we are looking for. */ { - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; Tcl_Obj *normPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr); int scnt, l, dirOnly = -1, mounts = 0; Tcl_Size prefixLen, len, strip = 0; @@ -5552,9 +5550,11 @@ ZipFSMatchInDirectoryProc( scnt = CountSlashes(pat); Tcl_HashTable duplicates; - int notDuplicate; + int notDuplicate = 0; Tcl_InitHashTable(&duplicates, TCL_STRING_KEYS); + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; if (foundInHash) { for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); hPtr; hPtr = Tcl_NextHashEntry(&search)) { @@ -5576,12 +5576,10 @@ ZipFSMatchInDirectoryProc( if (dirOnly) { /* * Not found in hash. May be a path that is the ancestor of a mount. - * e.g. glob //zipfs:/a/* with mount at //zipfs:/a/b/c. Also have + * e.g. glob //zipfs:/a/? with mount at //zipfs:/a/b/c. Also have * to be careful about duplicates, such as when another mount is * //zipfs:/a/b/d */ - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; Tcl_DString ds; Tcl_DStringInit(&ds); for (hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); hPtr; @@ -5596,8 +5594,8 @@ ZipFSMatchInDirectoryProc( zf->mountPoint + strip, end ? (Tcl_Size)(end - zf->mountPoint) : -1); const char *matchedPath = Tcl_DStringValue(&ds); - Tcl_HashEntry *dupTableEntry = - Tcl_CreateHashEntry(&duplicates, matchedPath, ¬Duplicate); + (void)Tcl_CreateHashEntry( + &duplicates, matchedPath, ¬Duplicate); if (notDuplicate) { AppendWithPrefix( result, prefixBuf, matchedPath, Tcl_DStringLength(&ds)); -- cgit v0.12