Fix some null pointer shenanigans

clang doesn't like anything but a bare 0 as null (and in some of the
cases, it was quite right: '\0' should not be treated as a null
pointer). And the crashers were just for paranoia and probably aren't
needed any more (kept for now, though).
This commit is contained in:
Bill Currie 2022-03-31 00:21:44 +09:00
parent 63e5655f68
commit 38319d01b2
4 changed files with 14 additions and 14 deletions

View file

@ -2849,7 +2849,7 @@ re_set_registers (bufp, regs, num_regs, starts, ends)
{
bufp->regs_allocated = REGS_UNALLOCATED;
regs->num_regs = 0;
regs->start = regs->end = (regoff_t) 0;
regs->start = regs->end = 0;
}
}

View file

@ -175,9 +175,9 @@ line_free (memsuper_t *super, memblock_t *block, void *mem)
for (l = &block->free_lines; *l; l = &(*l)->block_next) {
line = *l;
if (line->block_next && line->block_next < line) {
*(int *)0 = 0;
}
// if (line->block_next && line->block_next < line) {
// *(int *)0 = 0;
// }
if ((size_t) mem + size < (size_t) line) {
// line to be freed is below the free line
break;
@ -206,10 +206,10 @@ line_free (memsuper_t *super, memblock_t *block, void *mem)
link_free_line (super, line);
return;
}
if ((size_t) mem >= (size_t) line
&& (size_t) mem < (size_t) line + line->size) {
*(int *) 0 = 0;
}
// if ((size_t) mem >= (size_t) line
// && (size_t) mem < (size_t) line + line->size) {
// *(int *) 0 = 0;
// }
line = 0;
}
memline_t *memline = (memline_t *) mem;
@ -326,9 +326,9 @@ cmemalloc (memsuper_t *super, size_t size)
static void
unlink_block (memblock_t *block)
{
if (!block->free_lines || block->free_lines->block_next) {
*(int *) 0 = 0;
}
// if (!block->free_lines || block->free_lines->block_next) {
// *(int *) 0 = 0;
// }
unlink_line (block->free_lines);
if (block->next) {

View file

@ -324,7 +324,7 @@ gettokstart (char *str, int req, char delim)
start++;
}
if (*start == '\0')
return '\0';
return 0;
while (tok < req) { // Stop when we get to the requested
// token
if (*++start == delim) { // Increment pointer and test
@ -334,7 +334,7 @@ gettokstart (char *str, int req, char delim)
tok++;
}
if (*start == '\0') {
return '\0';
return 0;
}
}
return start;

View file

@ -251,7 +251,7 @@ split_edge (const vec4f_t *points, const vec4f_t *dists,
mid = (vec4f_t) ((vec4i_t) _mm_and_ps (y, (__m128) x) |
(vec4i_t) _mm_and_ps (mid, (__m128) ~x));
#endif
if (isnan (mid[0])) *(int *) 0 = 0;
// if (isnan (mid[0])) *(int *) 0 = 0;
return mid;
}