diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 16:59:00 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 16:59:00 +0200 |
commit | 88d23a2dbabf419ab4014b449be119a741aa54f5 (patch) | |
tree | c2ae91ad6c5b55a04bde5e1bfcb6b9b93d744009 /src/input/input_v4l.c | |
parent | 126e4215b279e95ca48e107dfe8ccf88d75508f6 (diff) | |
download | xine-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/input/input_v4l.c')
-rw-r--r-- | src/input/input_v4l.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index d0558b492..7bb5322b5 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -349,7 +349,7 @@ static pvrscr_t* pvrscr_init (void) { pvrscr_t *this; - this = (pvrscr_t *) xine_xmalloc(sizeof(pvrscr_t)); + this = calloc(1, sizeof(pvrscr_t)); this->scr.interface_version = 3; this->scr.get_priority = pvrscr_get_priority; @@ -719,13 +719,13 @@ static void allocate_audio_frames(v4l_input_plugin_t *this) buf_element_t *frame; /* Audio frame */ - frame = xine_xmalloc(sizeof(buf_element_t)); + frame = calloc(1, sizeof(buf_element_t)); frame->content = xine_xmalloc(this->periodsize); frame->type = BUF_AUDIO_LPCM_LE; frame->source = this; frame->free_buffer = store_aud_frame; - frame->extra_info = xine_xmalloc(sizeof(extra_info_t)); + frame->extra_info = calloc(1, sizeof(extra_info_t)); store_aud_frame(frame); } @@ -957,13 +957,13 @@ static int open_video_capture_device(v4l_input_plugin_t *this) for (i = 0; i < NUM_FRAMES; i++) { buf_element_t *frame; - frame = xine_xmalloc (sizeof (buf_element_t)); + frame = calloc(1, sizeof (buf_element_t)); frame->content = xine_xmalloc (this->frame_size); frame->type = this->frame_format; frame->source = this; frame->free_buffer = store_vid_frame; - frame->extra_info = xine_xmalloc(sizeof(extra_info_t)); + frame->extra_info = calloc(1, sizeof(extra_info_t)); store_vid_frame(frame); } @@ -1715,7 +1715,7 @@ static input_plugin_t *v4l_class_get_instance (input_class_t *cls_gen, return NULL; } - this = (v4l_input_plugin_t *) xine_xmalloc (sizeof (v4l_input_plugin_t)); + this = calloc(1, sizeof (v4l_input_plugin_t)); extract_mrl(this, mrl); @@ -1900,7 +1900,7 @@ static void *init_video_class (xine_t *xine, void *data) v4l_input_class_t *this; config_values_t *config = xine->config; - this = (v4l_input_class_t *) xine_xmalloc (sizeof (v4l_input_class_t)); + this = calloc(1, sizeof (v4l_input_class_t)); this->xine = xine; @@ -1934,7 +1934,7 @@ static void *init_radio_class (xine_t *xine, void *data) v4l_input_class_t *this; config_values_t *config = xine->config; - this = (v4l_input_class_t *) xine_xmalloc (sizeof (v4l_input_class_t)); + this = calloc(1, sizeof (v4l_input_class_t)); this->xine = xine; |