forge
Explore
Log in

Don't you dare go Hollow

use CStr literals over calling CStr::from_bytes_with_nul

Browse files at this commit

9b78b15ba5aa376a192549486fbec2eb54a7c816sodibooParent: b9fd0a4
src/render_helpers/shader_element.rsmodified+9 -9
@@ -1,5 +1,5 @@
1 use std::collections::HashMap;1 use std::collections::HashMap;
2-use std::ffi::{CStr, CString};2+use std::ffi::CString;
3 use std::rc::Rc;3 use std::rc::Rc;
4 4
5 use glam::{Mat3, Vec2};5 use glam::{Mat3, Vec2};
@@ -76,14 +76,14 @@ unsafe fn compile_program(
76 let debug_program =76 let debug_program =
77 unsafe { link_program(gl, include_str!("shaders/texture.vert"), &debug_shader)? };77 unsafe { link_program(gl, include_str!("shaders/texture.vert"), &debug_shader)? };
78 78
79- let vert = CStr::from_bytes_with_nul(b"vert\0").expect("NULL terminated");79+ let vert = c"vert";
80- let vert_position = CStr::from_bytes_with_nul(b"vert_position\0").expect("NULL terminated");80+ let vert_position = c"vert_position";
81- let matrix = CStr::from_bytes_with_nul(b"matrix\0").expect("NULL terminated");81+ let matrix = c"matrix";
82- let tex_matrix = CStr::from_bytes_with_nul(b"tex_matrix\0").expect("NULL terminated");82+ let tex_matrix = c"tex_matrix";
83- let size = CStr::from_bytes_with_nul(b"niri_size\0").expect("NULL terminated");83+ let size = c"niri_size";
84- let scale = CStr::from_bytes_with_nul(b"niri_scale\0").expect("NULL terminated");84+ let scale = c"niri_scale";
85- let alpha = CStr::from_bytes_with_nul(b"niri_alpha\0").expect("NULL terminated");85+ let alpha = c"niri_alpha";
86- let tint = CStr::from_bytes_with_nul(b"niri_tint\0").expect("NULL terminated");86+ let tint = c"niri_tint";
87 87
88 Ok(ShaderProgram(Rc::new(ShaderProgramInner {88 Ok(ShaderProgram(Rc::new(ShaderProgramInner {
89 normal: ShaderProgramInternal {89 normal: ShaderProgramInternal {