From 49c7405b6a88e56bb69e12189adb719927343e07 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Mon, 15 Nov 2021 19:37:48 +0000 Subject: Multiple smaller changes. - Remove the background image and libpng dependency - Add a prompt - Add xmalloc with out-of-memory handling - Add beginnings of a rofi-like run cache --- src/gl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gl.c') diff --git a/src/gl.c b/src/gl.c index b62e59e..09c7e1d 100644 --- a/src/gl.c +++ b/src/gl.c @@ -5,6 +5,7 @@ #include #include "gl.h" #include "log.h" +#include "xmalloc.h" #define max(a, b) ((a) > (b) ? (a) : (b)) @@ -197,7 +198,7 @@ void load_shader(GLuint shader, const char *filename) exit(EXIT_FAILURE); } unsigned long usize = (unsigned long) size; - GLchar *source = malloc(usize + 1); + GLchar *source = xmalloc(usize + 1); rewind(fp); if (fread(source, 1, usize, fp) != usize) { log_error("Failed to load shader %s: %s.\n", @@ -220,7 +221,7 @@ void load_shader(GLuint shader, const char *filename) GLint info_length = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_length); if (info_length > 1) { - char *log = malloc((unsigned)info_length * sizeof(*log)); + char *log = xmalloc((unsigned)info_length * sizeof(*log)); glGetShaderInfoLog(shader, info_length, NULL, log); log_error("\t%s\n", log); free(log); -- cgit v1.2.3