summaryrefslogtreecommitdiff
path: root/thirdparty/glad/glad.c
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/glad/glad.c')
-rw-r--r--thirdparty/glad/glad.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/thirdparty/glad/glad.c b/thirdparty/glad/glad.c
index 2d756ec3f6..f87ec8cf93 100644
--- a/thirdparty/glad/glad.c
+++ b/thirdparty/glad/glad.c
@@ -1,6 +1,6 @@
/*
- OpenGL loader generated by glad 0.1.14a0 on Wed Jun 14 20:12:45 2017.
+ OpenGL loader generated by glad 0.1.16a0 on Thu Nov 30 06:21:28 2017.
Language/Generator: C/C++
Specification: gl
@@ -92,7 +92,7 @@ int open_gl(void) {
}
static
-void close_gl() {
+void close_gl(void) {
if(libGL != NULL) {
dlclose(libGL);
libGL = NULL;
@@ -165,7 +165,18 @@ static int get_exts(void) {
}
for(index = 0; index < (unsigned)num_exts_i; index++) {
- exts_i[index] = (const char*)glGetStringi(GL_EXTENSIONS, index);
+ const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index);
+ size_t len = strlen(gl_str_tmp);
+
+ char *local_str = (char*)malloc((len+1) * sizeof(*exts_i));
+ if(local_str != NULL) {
+#if _MSC_VER >= 1400
+ strncpy_s(local_str, len+1, gl_str_tmp, len);
+#else
+ strncpy(local_str, gl_str_tmp, len+1);
+#endif
+ }
+ exts_i[index] = local_str;
}
}
#endif
@@ -174,6 +185,10 @@ static int get_exts(void) {
static void free_exts(void) {
if (exts_i != NULL) {
+ int index;
+ for(index = 0; index < num_exts_i; index++) {
+ free((char *)exts_i[index]);
+ }
free((void *)exts_i);
exts_i = NULL;
}
@@ -207,11 +222,11 @@ static int has_ext(const char *ext) {
#ifdef _GLAD_IS_SOME_NEW_VERSION
} else {
int index;
-
+ if(exts_i == NULL) return 0;
for(index = 0; index < num_exts_i; index++) {
const char *e = exts_i[index];
- if(strcmp(e, ext) == 0) {
+ if(exts_i[index] != NULL && strcmp(e, ext) == 0) {
return 1;
}
}