shuffle caddr_t to its only user, and use (void *) on Linux instead,
to appease Fefe’s dietlibc [-Wdeprecated-declarations]
This commit is contained in:
parent
3b87d173d4
commit
44c408f9ac
37
histrap.c
37
histrap.c
@ -26,15 +26,7 @@
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.112 2011/11/26 18:19:00 tg Exp $");
|
||||
|
||||
/*-
|
||||
* MirOS: This is the default mapping type, and need not be specified.
|
||||
* IRIX doesn't have this constant.
|
||||
*/
|
||||
#ifndef MAP_FILE
|
||||
#define MAP_FILE 0
|
||||
#endif
|
||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.113 2011/12/10 14:12:16 tg Exp $");
|
||||
|
||||
Trap sigtraps[NSIG + 1];
|
||||
static struct sigaction Sigact_ign;
|
||||
@ -60,6 +52,23 @@ static int hstarted; /* set after hist_init() called */
|
||||
static Source *hist_source;
|
||||
|
||||
#if HAVE_PERSISTENT_HISTORY
|
||||
/*XXX imake style */
|
||||
#if defined(__linux)
|
||||
#define caddr_cast(x) ((void *)(x))
|
||||
#else
|
||||
#define caddr_cast(x) ((caddr_t)(x))
|
||||
#endif
|
||||
|
||||
/* several OEs do not have these constants */
|
||||
#ifndef MAP_FAILED
|
||||
#define MAP_FAILED caddr_cast(-1)
|
||||
#endif
|
||||
|
||||
/* some OEs need the default mapping type specified */
|
||||
#ifndef MAP_FILE
|
||||
#define MAP_FILE 0
|
||||
#endif
|
||||
|
||||
/* current history file: name, fd, size */
|
||||
static char *hname;
|
||||
static int histfd;
|
||||
@ -741,7 +750,7 @@ hist_init(Source *s)
|
||||
if (base == (unsigned char *)MAP_FAILED ||
|
||||
*base != HMAGIC1 || base[1] != HMAGIC2) {
|
||||
if (base != (unsigned char *)MAP_FAILED)
|
||||
munmap((caddr_t)base, hsize);
|
||||
munmap(caddr_cast(base), hsize);
|
||||
hist_finish();
|
||||
if (unlink(hname) /* fails */)
|
||||
goto hiniterr;
|
||||
@ -753,7 +762,7 @@ hist_init(Source *s)
|
||||
/* we need to make the file smaller */
|
||||
if (hist_shrink(base, hsize))
|
||||
rv = unlink(hname);
|
||||
munmap((caddr_t)base, hsize);
|
||||
munmap(caddr_cast(base), hsize);
|
||||
hist_finish();
|
||||
if (rv) {
|
||||
hiniterr:
|
||||
@ -767,7 +776,7 @@ hist_init(Source *s)
|
||||
}
|
||||
}
|
||||
histload(hist_source, base+2, hsize-2);
|
||||
munmap((caddr_t)base, hsize);
|
||||
munmap(caddr_cast(base), hsize);
|
||||
}
|
||||
(void)flock(histfd, LOCK_UN);
|
||||
hfsize = lseek(histfd, (off_t)0, SEEK_END);
|
||||
@ -991,14 +1000,14 @@ writehistfile(int lno, char *cmd)
|
||||
goto bad;
|
||||
news = base + hsize;
|
||||
if (*news != COMMAND) {
|
||||
munmap((caddr_t)base, (size_t)sizenow);
|
||||
munmap(caddr_cast(base), (size_t)sizenow);
|
||||
goto bad;
|
||||
}
|
||||
hist_source->line--;
|
||||
histload(hist_source, news, bytes);
|
||||
hist_source->line++;
|
||||
lno = hist_source->line;
|
||||
munmap((caddr_t)base, (size_t)sizenow);
|
||||
munmap(caddr_cast(base), (size_t)sizenow);
|
||||
hsize = (size_t)sizenow;
|
||||
} else {
|
||||
/* it has shrunk */
|
||||
|
11
sh.h
11
sh.h
@ -151,7 +151,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.510 2011/12/10 13:34:18 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.511 2011/12/10 14:12:17 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R40 2011/12/10"
|
||||
|
||||
@ -283,15 +283,6 @@ typedef u_int8_t uint8_t;
|
||||
#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
|
||||
#endif
|
||||
|
||||
#if !defined(MAP_FAILED)
|
||||
/* XXX imake style */
|
||||
# if defined(__linux)
|
||||
#define MAP_FAILED ((void *)-1)
|
||||
# elif defined(__bsdi__) || defined(__osf__) || defined(__ultrix)
|
||||
#define MAP_FAILED ((caddr_t)-1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef NSIG
|
||||
#if defined(_NSIG)
|
||||
#define NSIG _NSIG
|
||||
|
Loading…
x
Reference in New Issue
Block a user