mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Make many string parameters const in the memory leak detector.
This commit is contained in:
parent
251dcb7f9f
commit
882d179fc8
@ -114,7 +114,7 @@ struct alloc_header {
|
|||||||
#endif
|
#endif
|
||||||
int size;
|
int size;
|
||||||
int line;
|
int line;
|
||||||
unsigned char *file;
|
const unsigned char *file;
|
||||||
unsigned char *comment;
|
unsigned char *comment;
|
||||||
|
|
||||||
#ifdef CHECK_XFLOWS
|
#ifdef CHECK_XFLOWS
|
||||||
@ -167,8 +167,8 @@ INIT_LIST_HEAD(memory_list);
|
|||||||
|
|
||||||
#ifdef LOG_MEMORY_ALLOC
|
#ifdef LOG_MEMORY_ALLOC
|
||||||
static void
|
static void
|
||||||
dump_short_info(struct alloc_header *ah, unsigned char *file, int line,
|
dump_short_info(struct alloc_header *ah, const unsigned char *file, int line,
|
||||||
unsigned char *type)
|
const unsigned char *type)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%p", PTR_AH2BASE(ah)), fflush(stderr);
|
fprintf(stderr, "%p", PTR_AH2BASE(ah)), fflush(stderr);
|
||||||
fprintf(stderr, ":%d", ah->size), fflush(stderr);
|
fprintf(stderr, ":%d", ah->size), fflush(stderr);
|
||||||
@ -184,8 +184,8 @@ dump_short_info(struct alloc_header *ah, unsigned char *file, int line,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dump_info(struct alloc_header *ah, unsigned char *info,
|
dump_info(struct alloc_header *ah, const unsigned char *info,
|
||||||
unsigned char *file, int line, unsigned char *type)
|
const unsigned char *file, int line, const unsigned char *type)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%p", PTR_AH2BASE(ah)); fflush(stderr);
|
fprintf(stderr, "%p", PTR_AH2BASE(ah)); fflush(stderr);
|
||||||
/* In some extreme cases, we may core here, as 'ah' can no longer point
|
/* In some extreme cases, we may core here, as 'ah' can no longer point
|
||||||
@ -213,8 +213,8 @@ dump_info(struct alloc_header *ah, unsigned char *info,
|
|||||||
|
|
||||||
#ifdef CHECK_AH_SANITY
|
#ifdef CHECK_AH_SANITY
|
||||||
static inline int
|
static inline int
|
||||||
bad_ah_sanity(struct alloc_header *ah, unsigned char *info,
|
bad_ah_sanity(struct alloc_header *ah, const unsigned char *info,
|
||||||
unsigned char *file, int line)
|
const unsigned char *file, int line)
|
||||||
{
|
{
|
||||||
if (!ah) return 1;
|
if (!ah) return 1;
|
||||||
if (ah->magic != AH_SANITY_MAGIC) {
|
if (ah->magic != AH_SANITY_MAGIC) {
|
||||||
@ -228,8 +228,8 @@ bad_ah_sanity(struct alloc_header *ah, unsigned char *info,
|
|||||||
|
|
||||||
#ifdef CHECK_XFLOWS
|
#ifdef CHECK_XFLOWS
|
||||||
static inline int
|
static inline int
|
||||||
bad_xflow_magic(struct alloc_header *ah, unsigned char *info,
|
bad_xflow_magic(struct alloc_header *ah, const unsigned char *info,
|
||||||
unsigned char *file, int line)
|
const unsigned char *file, int line)
|
||||||
{
|
{
|
||||||
if (!ah) return 1;
|
if (!ah) return 1;
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ check_memory_leaks(void)
|
|||||||
static int alloc_try = 0;
|
static int alloc_try = 0;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
patience(unsigned char *file, int line, unsigned char *of)
|
patience(const unsigned char *file, int line, const unsigned char *of)
|
||||||
{
|
{
|
||||||
errfile = file;
|
errfile = file;
|
||||||
errline = line;
|
errline = line;
|
||||||
@ -310,7 +310,7 @@ patience(unsigned char *file, int line, unsigned char *of)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
debug_mem_alloc(unsigned char *file, int line, size_t size)
|
debug_mem_alloc(const unsigned char *file, int line, size_t size)
|
||||||
{
|
{
|
||||||
struct alloc_header *ah;
|
struct alloc_header *ah;
|
||||||
size_t true_size;
|
size_t true_size;
|
||||||
@ -354,7 +354,7 @@ debug_mem_alloc(unsigned char *file, int line, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
debug_mem_calloc(unsigned char *file, int line, size_t eltcount, size_t eltsize)
|
debug_mem_calloc(const unsigned char *file, int line, size_t eltcount, size_t eltsize)
|
||||||
{
|
{
|
||||||
struct alloc_header *ah;
|
struct alloc_header *ah;
|
||||||
size_t size = eltcount * eltsize;
|
size_t size = eltcount * eltsize;
|
||||||
@ -405,7 +405,7 @@ debug_mem_calloc(unsigned char *file, int line, size_t eltcount, size_t eltsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
debug_mem_free(unsigned char *file, int line, void *ptr)
|
debug_mem_free(const unsigned char *file, int line, void *ptr)
|
||||||
{
|
{
|
||||||
struct alloc_header *ah;
|
struct alloc_header *ah;
|
||||||
int ok = 1;
|
int ok = 1;
|
||||||
@ -485,7 +485,7 @@ debug_mem_free(unsigned char *file, int line, void *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
debug_mem_realloc(unsigned char *file, int line, void *ptr, size_t size)
|
debug_mem_realloc(const unsigned char *file, int line, void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
struct alloc_header *ah, *ah2;
|
struct alloc_header *ah, *ah2;
|
||||||
size_t true_size;
|
size_t true_size;
|
||||||
@ -558,7 +558,7 @@ debug_mem_realloc(unsigned char *file, int line, void *ptr, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
set_mem_comment(void *ptr, unsigned char *str, int len)
|
set_mem_comment(void *ptr, const unsigned char *str, int len)
|
||||||
{
|
{
|
||||||
struct alloc_header *ah;
|
struct alloc_header *ah;
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@ struct mem_stats {
|
|||||||
|
|
||||||
extern struct mem_stats mem_stats;
|
extern struct mem_stats mem_stats;
|
||||||
|
|
||||||
void *debug_mem_alloc(unsigned char *, int, size_t);
|
void *debug_mem_alloc(const unsigned char *, int, size_t);
|
||||||
void *debug_mem_calloc(unsigned char *, int, size_t, size_t);
|
void *debug_mem_calloc(const unsigned char *, int, size_t, size_t);
|
||||||
void debug_mem_free(unsigned char *, int, void *);
|
void debug_mem_free(const unsigned char *, int, void *);
|
||||||
void *debug_mem_realloc(unsigned char *, int, void *, size_t);
|
void *debug_mem_realloc(const unsigned char *, int, void *, size_t);
|
||||||
void set_mem_comment(void *, unsigned char *, int);
|
void set_mem_comment(void *, const unsigned char *, int);
|
||||||
|
|
||||||
void check_memory_leaks(void);
|
void check_memory_leaks(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user