diff --git a/gl2.rs b/gl2.rs index 49bd5fd..21474ff 100644 --- a/gl2.rs +++ b/gl2.rs @@ -367,13 +367,6 @@ pub type GLsizeiptr = ssize_t; // gl2ext pub type GLeglImageOES = *c_void; -// Helper functions - -pub fn destroy(_x: T) { - // Just let the object drop. -} - - // Exposed Rust API using Rust naming conventions pub fn active_texture(texture: GLenum) { @@ -895,15 +888,15 @@ pub fn scissor(x: GLint, y: GLint, width: GLsizei, height: GLsizei) { } } -pub fn shader_source(shader: GLuint, strings: &[~[u8]]) { +pub fn shader_source(shader: GLuint, strings: &[&[u8]]) { + let pointers = strings.map(|string| (*string).as_ptr()); + let lengths = strings.map(|string| string.len() as GLint); unsafe { - let pointers = strings.map(|string| (*string).as_ptr()); - let lengths = strings.map(|string| string.len() as GLint); glShaderSource(shader, pointers.len() as GLsizei, pointers.as_ptr() as **GLchar, lengths.as_ptr()); - destroy(lengths); - destroy(pointers); } + drop(lengths); + drop(pointers); } // FIXME: Does not verify buffer size -- unsafe!