Support custom allocator
This commit is contained in:
parent
9c52a4932d
commit
cff38308b7
1 changed files with 10 additions and 2 deletions
12
src/external/glad.h
vendored
12
src/external/glad.h
vendored
|
@ -40,6 +40,14 @@
|
||||||
#define APIENTRYP APIENTRY *
|
#define APIENTRYP APIENTRY *
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// RAY: Added
|
||||||
|
#ifndef GLAD_REALLOC
|
||||||
|
#define GLAD_REALLOC(n,sz) realloc(n,sz)
|
||||||
|
#endif
|
||||||
|
#ifndef GLAD_FREE
|
||||||
|
#define GLAD_FREE(p) free(p)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -3760,7 +3768,7 @@ static int get_exts(void) {
|
||||||
num_exts_i = 0;
|
num_exts_i = 0;
|
||||||
glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);
|
glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);
|
||||||
if (num_exts_i > 0) {
|
if (num_exts_i > 0) {
|
||||||
exts_i = (const char **)realloc((void *)exts_i, num_exts_i * sizeof *exts_i);
|
exts_i = (const char **)GLAD_REALLOC((void *)exts_i, num_exts_i * sizeof *exts_i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exts_i == NULL) {
|
if (exts_i == NULL) {
|
||||||
|
@ -3777,7 +3785,7 @@ static int get_exts(void) {
|
||||||
|
|
||||||
static void free_exts(void) {
|
static void free_exts(void) {
|
||||||
if (exts_i != NULL) {
|
if (exts_i != NULL) {
|
||||||
free((char **)exts_i);
|
GLAD_FREE((char **)exts_i);
|
||||||
exts_i = NULL;
|
exts_i = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue