summaryrefslogtreecommitdiff
path: root/src/input/input_cdda.c
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-05-09 18:36:28 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2008-05-09 18:36:28 +0200
commit8532f9356cdbd6585c5d9eaf5d92588ae7ddecbe (patch)
treef83bcb762ea1f2d1d797e0779c72909189dc6da5 /src/input/input_cdda.c
parent4384f0b14a658b4179cedf77c2d6c2718610017b (diff)
downloadxine-lib-8532f9356cdbd6585c5d9eaf5d92588ae7ddecbe.tar.gz
xine-lib-8532f9356cdbd6585c5d9eaf5d92588ae7ddecbe.tar.bz2
Use asprintf() rather than sn?printf() + strn?dup().
Instead of duplicating a buffer after using sn?printf() on it, use asprintf() directly on the final variable.
Diffstat (limited to 'src/input/input_cdda.c')
-rw-r--r--src/input/input_cdda.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c
index 990f4d8b0..92eca7559 100644
--- a/src/input/input_cdda.c
+++ b/src/input/input_cdda.c
@@ -1532,14 +1532,9 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) {
int nyear;
y = strstr(buffer, "YEAR:");
- if(y) {
- if (sscanf(y+5, "%4d", &nyear) == 1) {
- char year[5];
-
- snprintf(year, 5, "%d", nyear);
- if (this->cddb.disc_year == NULL)
- this->cddb.disc_year = strdup(year);
- }
+ if (y && this->cddb.disc_year == NULL) {
+ if (sscanf(y+5, "%4d", &nyear) == 1)
+ asprintf(&this->cddb.disc_year, "%d", nyear);
}
}
}
@@ -1875,14 +1870,9 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) {
int nyear;
y = strstr(buffer, "YEAR:");
- if (y) {
- if (sscanf(y+5, "%4d", &nyear) == 1) {
- char year[5];
-
- snprintf(year, 5, "%d", nyear);
- if (this->cddb.disc_year == NULL)
- this->cddb.disc_year = strdup(year);
- }
+ if (y && this->cddb.disc_year == NULL) {
+ if (sscanf(y+5, "%4d", &nyear) == 1)
+ asprintf(&this->cddb.disc_year, "%d", nyear);
}
}
}