summaryrefslogtreecommitdiff
path: root/src/input/input_vcd.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/input/input_vcd.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/input/input_vcd.c')
-rw-r--r--src/input/input_vcd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index 007fa5946..02c2e83ab 100644
--- a/src/input/input_vcd.c
+++ b/src/input/input_vcd.c
@@ -889,7 +889,7 @@ static input_plugin_t *vcd_class_get_instance (input_class_t *cls_gen, xine_stre
return 0;
}
- this = (vcd_input_plugin_t *) xine_xmalloc(sizeof(vcd_input_plugin_t));
+ this = calloc(1, sizeof(vcd_input_plugin_t));
this->stream = stream;
this->mrl = mrl;
@@ -991,7 +991,7 @@ static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *file
++this->mrls_allocated_entries;
/* note: 1 extra pointer for terminating NULL */
this->mrls = realloc(this->mrls, (this->mrls_allocated_entries+1) * sizeof(xine_mrl_t*));
- this->mrls[(i-1)] = (xine_mrl_t *) xine_xmalloc(sizeof(xine_mrl_t));
+ this->mrls[(i-1)] = calloc(1, sizeof(xine_mrl_t));
}
else {
memset(this->mrls[(i-1)], 0, sizeof(xine_mrl_t));
@@ -1079,7 +1079,7 @@ static void *init_class (xine_t *xine, void *data) {
config_values_t *config = xine->config;
int i;
- this = (vcd_input_class_t *) xine_xmalloc (sizeof (vcd_input_class_t));
+ this = calloc(1, sizeof (vcd_input_class_t));
this->xine = xine;
@@ -1097,11 +1097,11 @@ static void *init_class (xine_t *xine, void *data) {
"you intend to play your VideoCDs with."),
10, device_change_cb, (void *)this);
- this->mrls = (xine_mrl_t **) xine_xmalloc(sizeof(xine_mrl_t*));
+ this->mrls = calloc(1, sizeof(xine_mrl_t*));
this->mrls_allocated_entries = 0;
for (i = 0; i < 100; i++) {
- this->filelist[i] = (char *) xine_xmalloc(sizeof(char *) * 256);
+ this->filelist[i] = calloc(256, sizeof(char));
}
return this;