[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53656] trunk/blender/source/blender/ blenfont/intern/blf_glyph.c: use guarded malloc for blf texture
Campbell Barton
ideasman42 at gmail.com
Tue Jan 8 15:04:05 CET 2013
Revision: 53656
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53656
Author: campbellbarton
Date: 2013-01-08 14:04:01 +0000 (Tue, 08 Jan 2013)
Log Message:
-----------
use guarded malloc for blf texture
Modified Paths:
--------------
trunk/blender/source/blender/blenfont/intern/blf_glyph.c
Modified: trunk/blender/source/blender/blenfont/intern/blf_glyph.c
===================================================================
--- trunk/blender/source/blender/blenfont/intern/blf_glyph.c 2013-01-08 13:58:01 UTC (rev 53655)
+++ trunk/blender/source/blender/blenfont/intern/blf_glyph.c 2013-01-08 14:04:01 UTC (rev 53656)
@@ -83,7 +83,7 @@
memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table));
memset(gc->bucket, 0, sizeof(gc->bucket));
- gc->textures = (GLuint *)malloc(sizeof(GLuint) * 256);
+ gc->textures = (GLuint *)MEM_mallocN(sizeof(GLuint) * 256, __func__);
gc->ntex = 256;
gc->cur_tex = -1;
gc->x_offs = 0;
@@ -150,7 +150,7 @@
if (gc->cur_tex + 1 > 0)
glDeleteTextures(gc->cur_tex + 1, gc->textures);
- free((void *)gc->textures);
+ MEM_freeN((void *)gc->textures);
MEM_freeN(gc);
}
@@ -178,8 +178,7 @@
gc->p2_height = font->max_tex_size;
tot_mem = gc->p2_width * gc->p2_height;
- buf = (unsigned char *)malloc(tot_mem);
- memset((void *)buf, 0, tot_mem);
+ buf = (unsigned char *)MEM_callocN(tot_mem, __func__);
glGenTextures(1, &gc->textures[gc->cur_tex]);
glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state = gc->textures[gc->cur_tex]));
@@ -189,7 +188,7 @@
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, gc->p2_width, gc->p2_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, buf);
- free((void *)buf);
+ MEM_freeN((void *)buf);
}
GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c)
More information about the Bf-blender-cvs
mailing list