mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 10:01:11 +02:00
Fix problems with zwcstat() on systems that do not USE_MMAP.
This commit is contained in:
parent
6d17bbde97
commit
9fbdcb5311
3 changed files with 25 additions and 19 deletions
|
@ -1,5 +1,8 @@
|
|||
2001-06-09 Bart Schaefer <schaefer@zsh.org>
|
||||
|
||||
* 14827: Src/parse.c, Src/utils.c: Move zwcstat() to parse.c
|
||||
where it can be wrapped in #ifdef USE_MMAP.
|
||||
|
||||
* 14824: Test/comptest: Avoid echotc (improvement on 14792).
|
||||
|
||||
2001-06-08 Clint Adams <clint@zsh.org>
|
||||
|
|
22
Src/parse.c
22
Src/parse.c
|
@ -2775,6 +2775,24 @@ build_cur_dump(char *nam, char *dump, char **names, int match, int map,
|
|||
|
||||
static FuncDump dumps;
|
||||
|
||||
/**/
|
||||
static int
|
||||
zwcstat(char *filename, struct stat *buf, FuncDump dumps)
|
||||
{
|
||||
FuncDump f;
|
||||
|
||||
if (stat(filename, buf)) {
|
||||
#ifdef HAVE_FSTAT
|
||||
for (f = dumps; f; f = f->next) {
|
||||
if (!strncmp(filename, f->filename, strlen(f->filename)) &&
|
||||
!fstat(f->fd, buf))
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
} else return 0;
|
||||
}
|
||||
|
||||
/* Load a dump file (i.e. map it). */
|
||||
|
||||
static void
|
||||
|
@ -2830,6 +2848,10 @@ load_dump_file(char *dump, struct stat *sbuf, int other, int len)
|
|||
d->filename = ztrdup(dump);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define zwcstat(f, b, d) stat(f, b)
|
||||
|
||||
#endif
|
||||
|
||||
/* Try to load a function from one of the possible wordcode files for it.
|
||||
|
|
19
Src/utils.c
19
Src/utils.c
|
@ -3829,22 +3829,3 @@ mailstat(char *path, struct stat *st)
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**/
|
||||
mod_export int
|
||||
zwcstat(char *filename, struct stat *buf, FuncDump dumps)
|
||||
{
|
||||
FuncDump f;
|
||||
|
||||
if (stat(filename, buf)) {
|
||||
#ifdef HAVE_FSTAT
|
||||
for (f = dumps; f; f = f->next) {
|
||||
if (!strncmp(filename, f->filename, strlen(f->filename)) &&
|
||||
!fstat(f->fd, buf))
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
} else return 0;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue