Skip to content

Commit

Permalink
Remove unused function: jv_mem_invalidate, jv_mem_uninit_setup (#2636)
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny authored Jun 28, 2023
1 parent d5dd41e commit 03db550
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
12 changes: 0 additions & 12 deletions src/jv_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,3 @@ void* jv_mem_realloc(void* p, size_t sz) {
}
return p;
}

#ifndef NDEBUG
volatile char jv_mem_uninitialised;
__attribute__((constructor)) void jv_mem_uninit_setup(){
// ignore warning that this reads uninitialized memory - that's the point!
#ifndef __clang_analyzer__
char* p = malloc(1);
jv_mem_uninitialised = *p;
free(p);
#endif
}
#endif
11 changes: 0 additions & 11 deletions src/jv_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@
#include <stddef.h>
#include "jv.h"

#ifndef NDEBUG
extern volatile char jv_mem_uninitialised;
#endif

static void jv_mem_invalidate(void* mem, size_t n) {
#ifndef NDEBUG
char* m = mem;
while (n--) *m++ ^= jv_mem_uninitialised ^ jv_mem_uninitialised;
#endif
}

void* jv_mem_alloc(size_t);
void* jv_mem_alloc_unguarded(size_t);
void* jv_mem_calloc(size_t, size_t);
Expand Down

0 comments on commit 03db550

Please sign in to comment.