kill a Clang 3.2 scan-build workaround (completely; tested by valgrind and

gcc-snapshot’s sanitisers to never be a problem)
This commit is contained in:
tg 2014-11-25 21:01:14 +00:00
parent d25612b4b0
commit 371ee4af07

23
shf.c
View File

@ -25,7 +25,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.62 2013/10/09 11:59:30 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.63 2014/11/25 21:01:14 tg Exp $");
/* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */
@ -767,12 +767,7 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
ssize_t field, precision, len;
unsigned long lnum;
/* %#o produces the longest output */
char numbuf[(8 * sizeof(long) + 2) / 3 + 1
#ifdef DEBUG
/* a NUL for LLVM/Clang scan-build */
+ 1
#endif
];
char numbuf[(8 * sizeof(long) + 2) / 3 + 1];
/* this stuff for dealing with the buffer */
ssize_t nwritten = 0;
@ -910,16 +905,6 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
integral:
flags |= FL_NUMBER;
cp = numbuf + sizeof(numbuf);
#ifdef DEBUG
/*
* this is necessary so Clang 3.2 realises
* utf_skipcols/shf_putc in the output loop
* terminate; these values are always ASCII
* so an out-of-bounds access cannot happen
* but Clang doesn't know that
*/
*--cp = '\0';
#endif
switch (c) {
case 'd':
@ -971,10 +956,6 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
}
}
len = numbuf + sizeof(numbuf) - (s = cp);
#ifdef DEBUG
/* see above comment for Clang 3.2 */
--len;
#endif
if (flags & FL_DOT) {
if (precision > len) {
field = precision;