diff options
author | Nikolas Garofil <nikolas@garofil.be> | 2014-06-07 13:48:40 -0700 |
---|---|---|
committer | Barton E. Schaefer <schaefer@zsh.org> | 2014-06-07 13:48:40 -0700 |
commit | 4f4d2b8247ef08e34fe73d91c0a8d8a2eb1f18c7 (patch) | |
tree | 8cb6ff32488f450f6f3455cf5f4bf24f2c6f5eb2 /Src | |
parent | 37ccdf58c09941a0e649551b8c30add1dfe512d5 (diff) | |
download | zsh-4f4d2b8247ef08e34fe73d91c0a8d8a2eb1f18c7.tar.gz zsh-4f4d2b8247ef08e34fe73d91c0a8d8a2eb1f18c7.tar.xz zsh-4f4d2b8247ef08e34fe73d91c0a8d8a2eb1f18c7.zip |
32737, 32736 (32741), 32735, 32734, 32733, 32732 (32739): Strict compilation
fixes Src/utils.c: properly ifdef declarations Src/zsh_system.h: memmove() should return its dest argument Src/signals.c: define ret before use Src/mem.c: remove unused pointers Src/prototypes.h: use size_t in bcopy() Src/compat.c: fix const declaration inconsistency
Diffstat (limited to 'Src')
-rw-r--r-- | Src/compat.c | 2 | ||||
-rw-r--r-- | Src/mem.c | 6 | ||||
-rw-r--r-- | Src/prototypes.h | 2 | ||||
-rw-r--r-- | Src/signals.c | 2 | ||||
-rw-r--r-- | Src/utils.c | 8 | ||||
-rw-r--r-- | Src/zsh_system.h | 5 |
6 files changed, 15 insertions, 10 deletions
diff --git a/Src/compat.c b/Src/compat.c index cc4e876da..b0bcb6265 100644 --- a/Src/compat.c +++ b/Src/compat.c @@ -37,7 +37,7 @@ char * strstr(const char *s, const char *t) { - char *p1, *p2; + const char *p1, *p2; for (; *s; s++) { for (p1 = s, p2 = t; *p2; p1++, p2++) diff --git a/Src/mem.c b/Src/mem.c index a7f11a62b..f19817723 100644 --- a/Src/mem.c +++ b/Src/mem.c @@ -1508,7 +1508,7 @@ zsfree(char *p) MALLOC_RET_T realloc(MALLOC_RET_T p, MALLOC_ARG_T size) { - struct m_hdr *m = (struct m_hdr *)(((char *)p) - M_ISIZE), *mp, *mt; + struct m_hdr *m = (struct m_hdr *)(((char *)p) - M_ISIZE), *mt; char *r; int i, l = 0; @@ -1524,10 +1524,10 @@ realloc(MALLOC_RET_T p, MALLOC_ARG_T size) /* check if we are reallocating a small block, if we do, we have to compute the size of the block from the sort of block it is in */ for (i = 0; i < M_NSMALL; i++) { - for (mp = NULL, mt = m_small[i]; + for (mt = m_small[i]; mt && (((char *)mt) > ((char *)p) || (((char *)mt) + mt->len) < ((char *)p)); - mp = mt, mt = mt->next); + mt = mt->next); if (mt) { l = M_BSLEN(mt->len); diff --git a/Src/prototypes.h b/Src/prototypes.h index 00988ac4c..e3db4f5ee 100644 --- a/Src/prototypes.h +++ b/Src/prototypes.h @@ -130,5 +130,5 @@ extern char *strerror _((int errnum)); /***************************************************/ #ifndef HAVE_MEMMOVE -extern void bcopy _((const void *, void *, int)); +extern void bcopy _((const void *, void *, size_t)); #endif diff --git a/Src/signals.c b/Src/signals.c index a6eb8038b..cb2b58161 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -369,7 +369,7 @@ signal_suspend(UNUSED(int sig), int wait_cmd) #ifdef POSIX_SIGNALS # ifdef BROKEN_POSIX_SIGSUSPEND sigprocmask(SIG_SETMASK, &set, &oset); - pause(); + ret = pause(); sigprocmask(SIG_SETMASK, &oset, NULL); # else /* not BROKEN_POSIX_SIGSUSPEND */ ret = sigsuspend(&set); diff --git a/Src/utils.c b/Src/utils.c index 59b9435ff..cef2abef8 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -2712,8 +2712,11 @@ ztrftimebuf(int *bufsizeptr, int decr) mod_export int ztrftime(char *buf, int bufsize, char *fmt, struct tm *tm) { - int hr12, decr; -#ifndef HAVE_STRFTIME + int hr12; +#ifdef HAVE_STRFTIME + int decr; + char tmp[4]; +#else static char *astr[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; static char *estr[] = @@ -2721,7 +2724,6 @@ ztrftime(char *buf, int bufsize, char *fmt, struct tm *tm) "Aug", "Sep", "Oct", "Nov", "Dec"}; #endif char *origbuf = buf; - char tmp[4]; while (*fmt) diff --git a/Src/zsh_system.h b/Src/zsh_system.h index e68fd62f9..6887a135b 100644 --- a/Src/zsh_system.h +++ b/Src/zsh_system.h @@ -708,7 +708,10 @@ struct timezone { #endif #ifndef HAVE_MEMMOVE -# define memmove(dest, src, len) bcopy((src), (dest), (len)) +# ifndef memmove +static char *zmmv; +# define memmove(dest, src, len) (bcopy((src), zmmv = (dest), (len)), zmmv) +# endif #endif #ifndef offsetof |