Johannes Weißl
2011-01-26 00:50:02 UTC
---
track_info.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/track_info.c b/track_info.c
index 38763f0..f32395e 100644
--- a/track_info.c
+++ b/track_info.c
@@ -38,11 +38,8 @@ static void track_info_free(struct track_info *ti)
struct track_info *track_info_new(const char *filename)
{
struct track_info *ti;
- int size = strlen(filename) + 1;
-
- ti = xmalloc(sizeof(struct track_info));
- ti->filename = xmalloc(size);
- memcpy(ti->filename, filename, size);
+ ti = xnew(struct track_info, 1);
+ ti->filename = xstrdup(filename);
ti->ref = 1;
return ti;
}
track_info.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/track_info.c b/track_info.c
index 38763f0..f32395e 100644
--- a/track_info.c
+++ b/track_info.c
@@ -38,11 +38,8 @@ static void track_info_free(struct track_info *ti)
struct track_info *track_info_new(const char *filename)
{
struct track_info *ti;
- int size = strlen(filename) + 1;
-
- ti = xmalloc(sizeof(struct track_info));
- ti->filename = xmalloc(size);
- memcpy(ti->filename, filename, size);
+ ti = xnew(struct track_info, 1);
+ ti->filename = xstrdup(filename);
ti->ref = 1;
return ti;
}
--
1.7.2.3
1.7.2.3