Realloc: Make behavior of realloc(ptr, 0) configurable.
This commit is contained in:
committed by
David Goldblatt
parent
ee961c2310
commit
9cfa805947
@@ -18,6 +18,8 @@ extern bool opt_utrace;
|
||||
extern bool opt_xmalloc;
|
||||
extern bool opt_zero;
|
||||
extern unsigned opt_narenas;
|
||||
extern zero_realloc_action_t opt_zero_realloc_action;
|
||||
extern const char *zero_realloc_mode_names[];
|
||||
|
||||
/* Number of CPUs. */
|
||||
extern unsigned ncpus;
|
||||
|
@@ -12,6 +12,17 @@ typedef unsigned szind_t;
|
||||
/* Processor / core id type. */
|
||||
typedef int malloc_cpuid_t;
|
||||
|
||||
/* When realloc(non-null-ptr, 0) is called, what happens? */
|
||||
enum zero_realloc_action_e {
|
||||
/* Realloc(ptr, 0) is free(ptr); return malloc(0); */
|
||||
zero_realloc_action_strict = 0,
|
||||
/* Realloc(ptr, 0) is free(ptr); */
|
||||
zero_realloc_action_free = 1,
|
||||
/* Realloc(ptr, 0) aborts. */
|
||||
zero_realloc_action_abort = 2
|
||||
};
|
||||
typedef enum zero_realloc_action_e zero_realloc_action_t;
|
||||
|
||||
/*
|
||||
* Flags bits:
|
||||
*
|
||||
|
Reference in New Issue
Block a user