summaryrefslogtreecommitdiff
path: root/src/libfaad
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/libfaad
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/libfaad')
-rw-r--r--src/libfaad/xine_faad_decoder.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libfaad/xine_faad_decoder.c b/src/libfaad/xine_faad_decoder.c
index 934140a32..6f86d95fd 100644
--- a/src/libfaad/xine_faad_decoder.c
+++ b/src/libfaad/xine_faad_decoder.c
@@ -320,7 +320,7 @@ static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
if( !this->faac_dec && (buf->decoder_flags & BUF_FLAG_SPECIAL) &&
buf->decoder_info[1] == BUF_SPECIAL_DECODER_CONFIG ) {
- this->dec_config = xine_xmalloc(buf->decoder_info[2]);
+ this->dec_config = malloc(buf->decoder_info[2]);
this->dec_config_size = buf->decoder_info[2];
memcpy(this->dec_config, buf->decoder_info_ptr[2], buf->decoder_info[2]);
@@ -341,7 +341,7 @@ static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
xine_waveformatex *wavex = (xine_waveformatex *) buf->content;
if( wavex->cbSize > 0 ) {
- this->dec_config = xine_xmalloc(wavex->cbSize);
+ this->dec_config = malloc(wavex->cbSize);
this->dec_config_size = wavex->cbSize;
memcpy(this->dec_config, buf->content + sizeof(xine_waveformatex),
wavex->cbSize);
@@ -417,7 +417,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre
faad_decoder_t *this ;
- this = (faad_decoder_t *) xine_xmalloc (sizeof (faad_decoder_t));
+ this = calloc(1, sizeof (faad_decoder_t));
this->audio_decoder.decode_data = faad_decode_data;
this->audio_decoder.reset = faad_reset;
@@ -458,7 +458,7 @@ static void *init_plugin (xine_t *xine, void *data) {
faad_class_t *this ;
- this = (faad_class_t *) xine_xmalloc (sizeof (faad_class_t));
+ this = calloc(1, sizeof (faad_class_t));
this->decoder_class.open_plugin = open_plugin;
this->decoder_class.get_identifier = get_identifier;