Sun, 15 Jun 2025 19:50:51 +0200
since we cannot pass NULL strings anyway, we do not need cxstring
src/shader.c | file | annotate | diff | comparison | revisions |
--- a/src/shader.c Sun Jun 15 19:46:12 2025 +0200 +++ b/src/shader.c Sun Jun 15 19:50:51 2025 +0200 @@ -57,14 +57,16 @@ if (code_pp == NULL) code_pp = ""; GLint success; - const char *code_array[4]; + const char *code_array[4] = { + "#version 400 core\n", + code_pp, + "\n#line 1\n", + code + }; GLint length_array[4]; -#define store_str(i, s) do {cxstring cxs = cx_str(s); code_array[i] = cxs.ptr; length_array[i] = (GLint) cxs.length;} while(0) - store_str(0, "#version 400 core\n"); - store_str(1, code_pp); - store_str(2, "\n#line 1\n"); - store_str(3, code); -#undef store_str + for (unsigned int i = 0; i < cx_nmemb(length_array); i++) { + length_array[i] = (GLint) strlen(code_array[i]); + } // compile glShaderSource(id, cx_nmemb(length_array), code_array, length_array);