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:
parent
d25612b4b0
commit
371ee4af07
23
shf.c
23
shf.c
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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() */
|
/* flags to shf_emptybuf() */
|
||||||
#define EB_READSW 0x01 /* about to switch to reading */
|
#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;
|
ssize_t field, precision, len;
|
||||||
unsigned long lnum;
|
unsigned long lnum;
|
||||||
/* %#o produces the longest output */
|
/* %#o produces the longest output */
|
||||||
char numbuf[(8 * sizeof(long) + 2) / 3 + 1
|
char numbuf[(8 * sizeof(long) + 2) / 3 + 1];
|
||||||
#ifdef DEBUG
|
|
||||||
/* a NUL for LLVM/Clang scan-build */
|
|
||||||
+ 1
|
|
||||||
#endif
|
|
||||||
];
|
|
||||||
/* this stuff for dealing with the buffer */
|
/* this stuff for dealing with the buffer */
|
||||||
ssize_t nwritten = 0;
|
ssize_t nwritten = 0;
|
||||||
|
|
||||||
@ -910,16 +905,6 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
|
|||||||
integral:
|
integral:
|
||||||
flags |= FL_NUMBER;
|
flags |= FL_NUMBER;
|
||||||
cp = numbuf + sizeof(numbuf);
|
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) {
|
switch (c) {
|
||||||
case 'd':
|
case 'd':
|
||||||
@ -971,10 +956,6 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
len = numbuf + sizeof(numbuf) - (s = cp);
|
len = numbuf + sizeof(numbuf) - (s = cp);
|
||||||
#ifdef DEBUG
|
|
||||||
/* see above comment for Clang 3.2 */
|
|
||||||
--len;
|
|
||||||
#endif
|
|
||||||
if (flags & FL_DOT) {
|
if (flags & FL_DOT) {
|
||||||
if (precision > len) {
|
if (precision > len) {
|
||||||
field = precision;
|
field = precision;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user