Remove dead stores detected by static analysis

None of these are harmful, and they are almost certainly optimized
away by the compiler. The motivation for fixing them anyway is that
we'd like to enable static analysis as part of CI, and the first step
towards that is resolving the warnings it produces at present.
This commit is contained in:
Kevin Svetlitski 2023-04-26 14:10:41 -07:00 committed by Qi Wang
parent 0288126d9c
commit 3e2ba7a651
6 changed files with 7 additions and 13 deletions

View file

@ -68,7 +68,6 @@ static int madvise_dont_need_zeros_is_faulty = -1;
*/
static int madvise_MADV_DONTNEED_zeroes_pages()
{
int works = -1;
size_t size = PAGE;
void * addr = mmap(NULL, size, PROT_READ|PROT_WRITE,
@ -83,6 +82,7 @@ static int madvise_MADV_DONTNEED_zeroes_pages()
}
memset(addr, 'A', size);
int works;
if (madvise(addr, size, MADV_DONTNEED) == 0) {
works = memchr(addr, 'A', size) == NULL;
} else {