Skip to content
Newer
Older
100644 38 lines (32 sloc) 848 Bytes
908ced3 Added EL-ELI.c source for easy reference to binding
Chris Marshall authored Jun 12, 2009
1 GLvoid * EL(SV * sv, int needlen)
2 {
3 STRLEN skip = 0;
4 SV * svref;
5
6 if (SvREADONLY(sv))
7 croak("Readonly value for buffer");
8
9 if(SvROK(sv)) {
10 svref = SvRV(sv);
11 sv = svref;
12 }
13 else
14 {
15 #ifdef USE_STRICT_UNGLOB
16 if (SvFAKE(sv) && SvTYPE(sv) == SVt_PVGV)
17 sv_unglob(sv);
18 #endif
19
20 SvUPGRADE(sv, SVt_PV);
21 SvGROW(sv, (unsigned int)(needlen + 1));
22 SvPOK_on(sv);
23 SvCUR_set(sv, needlen);
24 *SvEND(sv) = '\0'; /* Why is this here? -chm */
25 }
26
27 return SvPV_force(sv, skip);
28 }
29
30 GLvoid * ELI(SV * sv, GLsizei width, GLsizei height,
31 GLenum format, GLenum type, int mode)
32 {
33 int needlen = 0;
34 if (!SvROK(sv)) /* don't calc length if arg is a perl ref */
35 needlen = gl_pixelbuffer_size(format, width, height, type, mode);
36 return EL(sv, needlen);
37 }
Something went wrong with that request. Please try again.