summaryrefslogtreecommitdiff
path: root/src/xine-engine/osd.c
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-05-07 16:59:00 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-05-07 16:59:00 +0200
commit88d23a2dbabf419ab4014b449be119a741aa54f5 (patch)
treec2ae91ad6c5b55a04bde5e1bfcb6b9b93d744009 /src/xine-engine/osd.c
parent126e4215b279e95ca48e107dfe8ccf88d75508f6 (diff)
downloadxine-lib-88d23a2dbabf419ab4014b449be119a741aa54f5.tar.gz
xine-lib-88d23a2dbabf419ab4014b449be119a741aa54f5.tar.bz2
xine_xmalloc() deprecation: replace its use with static and non-zero size.
The xine_xmalloc() function is going to be deprecated, as its behaviour is rarely needed as such, and it's thus misused. With this, almost all uses of xine_xmalloc() with static size (for instance the value returned by sizeof()) or with a size that is guaranteed not to be zero (like strlen()+1) are replaced with calls to either calloc(1, ...) or malloc(). malloc() is used whenever the allocated memory is going to be immediately overwritten, while calloc() is used in every other case, as it sets the whole memory area to zero. --HG-- extra : transplant_source : %8F%98%EC%02%1E%83%F0s%06X%83C%205Y%80%B12%CC%E1
Diffstat (limited to 'src/xine-engine/osd.c')
-rw-r--r--src/xine-engine/osd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c
index ef888e7a4..5de0de2cb 100644
--- a/src/xine-engine/osd.c
+++ b/src/xine-engine/osd.c
@@ -149,7 +149,7 @@ static osd_object_t *osd_new_object (osd_renderer_t *this, int width, int height
pthread_mutex_lock (&this->osd_mutex);
- osd = xine_xmalloc( sizeof(osd_object_t) );
+ osd = calloc(1, sizeof(osd_object_t));
osd->renderer = this;
osd->next = this->osds;
this->osds = osd;
@@ -670,7 +670,7 @@ static int osd_renderer_load_font(osd_renderer_t *this, char *filename) {
/* fixme: check for all read errors... */
if( (fp = gzopen(filename,"rb")) != NULL ) {
- font = xine_xmalloc( sizeof(osd_font_t) );
+ font = calloc(1, sizeof(osd_font_t));
gzread(fp, font->name, sizeof(font->name) );
font->version = gzread_i16(fp);
@@ -818,7 +818,7 @@ static int osd_renderer_unload_font(osd_renderer_t *this, char *fontname ) {
#ifdef HAVE_FT2
static int osd_set_font_freetype2( osd_object_t *osd, const char *fontname, int size ) {
if (!osd->ft2) {
- osd->ft2 = xine_xmalloc(sizeof(osd_ft2context_t));
+ osd->ft2 = calloc(1, sizeof(osd_ft2context_t));
if(FT_Init_FreeType( &osd->ft2->library )) {
xprintf(osd->renderer->stream->xine, XINE_VERBOSITY_LOG,
_("osd: cannot initialize ft2 library\n"));
@@ -1413,7 +1413,7 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) {
char *pathname;
*p++ = '\0';
- font = xine_xmalloc( sizeof(osd_font_t) );
+ font = calloc(1, sizeof(osd_font_t) );
strncpy(font->name, s, sizeof(font->name));
font->size = atoi(p);
@@ -1421,7 +1421,7 @@ static void osd_preload_fonts (osd_renderer_t *this, char *path) {
lprintf("font '%s' size %d is preloaded\n",
font->name, font->size);
- pathname = (char *) xine_xmalloc(strlen(path) + strlen(entry->d_name) + 2);
+ pathname = malloc(strlen(path) + strlen(entry->d_name) + 2);
sprintf (pathname, "%s/%s", path, entry->d_name);
font->filename = pathname;
@@ -1579,9 +1579,9 @@ osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) {
osd_renderer_t *this;
char str[1024];
- this = xine_xmalloc(sizeof(osd_renderer_t));
+ this = calloc(1, sizeof(osd_renderer_t));
this->stream = stream;
- this->event.object.overlay = xine_xmalloc( sizeof(vo_overlay_t) );
+ this->event.object.overlay = calloc(1, sizeof(vo_overlay_t));
pthread_mutex_init (&this->osd_mutex, NULL);