blob: 9b5f71d46cbdd1d17a57d15ec664f2b2ec650e5e (
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
35
36
37
|
#include "ref.h"
#include "track.h"
#include <wchar.h>
#include <string.h>
#include <sys/stat.h>
struct track *
track_alloc(const char *dir, const char *fname, int fid)
{
struct track *track;
int len;
track = malloc(sizeof(struct track));
ASSERT(track != NULL);
track->fpath = aprintf("%s/%s", dir, fname);
ASSERT(track->fpath != NULL);
track->name = strdup(fname);
ASSERT(track->name != NULL);
track->fid = fid;
list_init(&track->tags);
return track;
}
void
track_free(struct track *t)
{
free(t->fpath);
free(t->name);
refs_free(&t->tags);
free(t);
}
|