blob: f7aa2a9fe2f8e29b8b88372b26432ec16d9e7424 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include "track.h"
#include <wchar.h>
#include <string.h>
struct track *
track_init(const char *dir, const char *file)
{
struct track *track;
track = malloc(sizeof(struct track));
ASSERT(track != NULL);
track->fname = strdup(file);
ASSERT(track->fname != NULL);
track->fpath = aprintf("%s/%s", dir, file);
ASSERT(track->fpath != NULL);
track->name = calloc(strlen(track->fname) + 1, sizeof(wchar_t));
mbstowcs(track->name, track->fname, strlen(track->fname) + 1);
track->link = LINK_EMPTY;
track->tags = LIST_HEAD;
return track;
}
void
track_free(struct track *t)
{
free(t->fname);
free(t->fpath);
free(t->name);
}
|