diff src/libmlk-core/core/texture.c @ 419:1b4e61bdb9ab

core: introduce err.h
author David Demelier <markand@malikania.fr>
date Wed, 12 Oct 2022 15:06:18 +0200
parents 460c78706989
children 3edda1ce314c
line wrap: on
line diff
--- a/src/libmlk-core/core/texture.c	Mon Oct 10 12:34:31 2022 +0200
+++ b/src/libmlk-core/core/texture.c	Wed Oct 12 15:06:18 2022 +0200
@@ -27,17 +27,19 @@
 #include "window.h"
 #include "window_p.h"
 
-int
+enum mlk_err
 texture_new(struct texture *tex, unsigned int w, unsigned int h)
 {
 	assert(tex);
+	assert(w);
+	assert(h);
 
 	tex->handle = SDL_CreateTexture(RENDERER(),
 	    SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, w, h);
 
 	if (!tex->handle) {
 		tex->w = tex->h = 0;
-		return errorf("%s", SDL_GetError());
+		return MLK_ERR_INTERNAL;
 	}
 
 	tex->w = w;