mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-20 09:21:09 +00:00
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:
parent
63e5655f68
commit
38319d01b2
4 changed files with 14 additions and 14 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue