From 4f4d2b8247ef08e34fe73d91c0a8d8a2eb1f18c7 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sat, 7 Jun 2014 13:48:40 -0700 Subject: 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 --- ChangeLog | 16 ++++++++++++++++ Src/compat.c | 2 +- Src/mem.c | 6 +++--- Src/prototypes.h | 2 +- Src/signals.c | 2 +- Src/utils.c | 8 +++++--- Src/zsh_system.h | 5 ++++- 7 files changed, 31 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 056ad1f3e..3a304c0ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2014-06-07 Barton E. Schaefer + + * Nikolas Garofil: 32737: Src/utils.c: properly ifdef declarations + + * Nikolas Garofil: 32736 (tweak per 32741): Src/zsh_system.h: + memmove() should return its dest argument + + * Nikolas Garofil: 32735: Src/signals.c: define ret before use + + * Nikolas Garofil: 32734: Src/mem.c: remove unused pointers + + * Nikolas Garofil: 32733: Src/prototypes.h: use size_t in bcopy() + + * Nikolas Garofil: 32732 (tweak per 32739): Src/compat.c: fix + const declaration inconsistency + 2014-06-06 Peter Stephenson * Jun T: 32719: Doc/Zsh/contrib.yo: minor issues. 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 -- cgit 1.4.1