From: sof Date: Fri, 4 Jan 2002 23:21:18 +0000 (+0000) Subject: [project @ 2002-01-04 23:21:18 by sof] X-Git-Tag: Approximately_9120_patches~317 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=8d62f0218fee393fb1a13636935ae3ce89056555;p=ghc-hetmet.git [project @ 2002-01-04 23:21:18 by sof] prel_readdir: tidied --- diff --git a/ghc/lib/std/cbits/dirUtils.c b/ghc/lib/std/cbits/dirUtils.c index c61d730..604a911 100644 --- a/ghc/lib/std/cbits/dirUtils.c +++ b/ghc/lib/std/cbits/dirUtils.c @@ -76,13 +76,14 @@ HsInt prel_end_of_dir() HsInt prel_readdir(HsAddr dirPtr, HsAddr pDirEnt) { + struct dirent **pDirE = (struct dirent**)pDirEnt; #if HAVE_READDIR_R struct dirent* p; struct dirent* r; int res; static unsigned int nm_max = -1; - if ((struct dirent**)pDirEnt == NULL) { + if (pDirE == NULL) { return -1; } if (nm_max == -1) { @@ -95,14 +96,13 @@ prel_readdir(HsAddr dirPtr, HsAddr pDirEnt) #endif } p = (struct dirent*)malloc(sizeof(struct dirent) + nm_max); - res = readdir_r((DIR*)dirPtr, p, (struct dirent**)pDirEnt); + res = readdir_r((DIR*)dirPtr, p, pDirE); if (res != 0) { - *pDirEnt = NULL; + *pDirE = NULL; free(p); } return res; #else - struct dirent **pDirE = (struct dirent**)pDirEnt; if (pDirE == NULL) { return -1;