Skip to content

Commit

Permalink
Namespace cleanup: Prefix artist with ds_
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonKagstrom committed Mar 13, 2011
1 parent b9df4b0 commit aa0bb60
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/bindings/ruby/ext/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ VALUE eDespotifyError;

typedef struct ds_album ds_album_t;
typedef struct ds_album_browse ds_album_browse_t;
typedef struct artist ds_artist_t;
typedef struct ds_artist ds_artist_t;
typedef struct artist_browse ds_artist_browse_t;
typedef struct ds_playlist ds_playlist_t;
typedef struct link ds_link_t;
Expand Down
2 changes: 1 addition & 1 deletion src/clients/despotify/ui_tracklist.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void tracklist_draw(ui_t *ui)
// Concat list of artists.
wchar_t art[slen];
int len = 0;
for (struct artist* a = t->artist; a && len < slen; a = a->next)
for (struct ds_artist* a = t->artist; a && len < slen; a = a->next)
len += swprintf(art + len, slen - len, L"%s%s", a->name, a->next ? "/" : "");

wchar_t str[ui->width];
Expand Down
8 changes: 4 additions & 4 deletions src/clients/simple/simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void print_tracks(struct ds_track* head)
if (t->has_meta_data) {
wrapper_wprintf(L"%3d: %-40s %2d:%02d ", count++, t->title,
t->length / 60000, t->length % 60000 / 1000);
for (struct artist* a = t->artist; a; a = a->next)
for (struct ds_artist* a = t->artist; a; a = a->next)
wrapper_wprintf(L"%s%s", a->name, a->next ? ", " : "");
wrapper_wprintf(L" %s\n", t->playable ? "" : "(Unplayable)");
}
Expand All @@ -170,7 +170,7 @@ void print_track_full(struct ds_track* t)
wrapper_wprintf(L"\nTitle: %s\nAlbum: %s\nArtist(s): ",
t->title, t->album);

for (struct artist* a = t->artist; a; a = a->next)
for (struct ds_artist* a = t->artist; a; a = a->next)
wrapper_wprintf(L"%s%s", a->name, a->next ? ", " : "");

wrapper_wprintf(L"\nYear: %d\nLength: %02d:%02d\n\n",
Expand Down Expand Up @@ -213,7 +213,7 @@ void print_search(struct ds_search_result *search)
if (search->total_artists > 0) {
wrapper_wprintf(L"\nArtists found (%d):\n", search->total_artists);

for (struct artist* artist = search->artists; artist; artist = artist->next)
for (struct ds_artist* artist = search->artists; artist; artist = artist->next)
wrapper_wprintf(L" %s\n", artist->name);
}

Expand Down Expand Up @@ -410,7 +410,7 @@ void command_loop(struct despotify_session* ds)
for (int i=1; i<num; i++)
t = t->next;

for (struct artist* aptr = t->artist; aptr; aptr = aptr->next) {
for (struct ds_artist* aptr = t->artist; aptr; aptr = aptr->next) {
struct artist_browse* a = despotify_get_artist(ds, aptr->id);
print_artist(a);
despotify_free_artist_browse(a);
Expand Down
6 changes: 3 additions & 3 deletions src/lib/despotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,13 +882,13 @@ static bool despotify_load_tracks(struct despotify_session *ds, bool cache_do_st
t->next = next;

/* deep copy of artist list */
struct artist* a = calloc(1, sizeof(struct artist));
struct ds_artist* a = calloc(1, sizeof(struct ds_artist));
t->artist = a;
struct artist* ta;
struct ds_artist* ta;
for (ta = tt->artist; ta; ta = ta->next) {
*a = *ta;
if (ta->next)
a = a->next = calloc(1, sizeof(struct artist));
a = a->next = calloc(1, sizeof(struct ds_artist));
}

/* deep copy of georestrictions. */
Expand Down
8 changes: 4 additions & 4 deletions src/lib/despotify.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct ds_track
char *forbidden;

char title[STRING_LENGTH];
struct artist* artist;
struct ds_artist* artist;
char album[STRING_LENGTH];
int length;
int tracknumber;
Expand All @@ -43,7 +43,7 @@ struct ds_search_result
int total_artists;
int total_albums;
int total_tracks;
struct artist *artists;
struct ds_artist *artists;
struct ds_album *albums;
struct ds_track *tracks;
struct ds_playlist *playlist;
Expand Down Expand Up @@ -85,13 +85,13 @@ struct ds_album_browse
struct ds_album_browse* next; /* in case of multiple albums in an artist struct */
};

struct artist
struct ds_artist
{
char name[STRING_LENGTH];
char id[33];
char portrait_id[41];
float popularity;
struct artist* next;
struct ds_artist* next;
};

struct artist_browse
Expand Down
20 changes: 10 additions & 10 deletions src/lib/xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ static int parse_tracks(ezxml_t xml, struct ds_track* t, bool ordered, bool high
xmlstrncpy(t->album_id, sizeof t->album_id, track, "album-id", -1);

/* create list of artists */
struct artist* preva = NULL;
struct artist* artist = calloc(1, sizeof(struct artist));
struct ds_artist* preva = NULL;
struct ds_artist* artist = calloc(1, sizeof(struct ds_artist));
t->artist = artist;
ezxml_t xid = ezxml_get(track, "artist-id", -1);
for (ezxml_t xa = ezxml_get(track, "artist", -1); xa; xa = xa->next) {
if (preva) {
artist = calloc(1, sizeof(struct artist));
artist = calloc(1, sizeof(struct ds_artist));
preva->next = artist;
}
DSFYstrncpy(artist->name, xa->txt, sizeof artist->name);
Expand Down Expand Up @@ -335,7 +335,7 @@ static void parse_album(ezxml_t top, struct ds_album* a) {
xmlatof(&a->popularity, top, "popularity", -1);
}

static void parse_artist(ezxml_t top, struct artist *a) {
static void parse_artist(ezxml_t top, struct ds_artist *a) {
xmlstrncpy(a->name, sizeof a->name, top, "name", -1);
xmlstrncpy(a->id, sizeof a->id, top, "id", -1);
xmlstrncpy(a->portrait_id, sizeof a->portrait_id, top,
Expand Down Expand Up @@ -399,12 +399,12 @@ int xml_parse_search(struct ds_search_result* search,
xmlatoi(&search->total_tracks, top, "total-tracks", -1);

ezxml_t artists = ezxml_get(top, "artists",-1);
struct artist *prev = NULL;
struct artist *artist = calloc(1, sizeof(struct artist));
struct ds_artist *prev = NULL;
struct ds_artist *artist = calloc(1, sizeof(struct ds_artist));
search->artists = artist;
for (ezxml_t xa = ezxml_get(artists, "artist", -1); xa; xa = xa->next) {
if(prev) {
artist = calloc(1, sizeof(struct artist));
artist = calloc(1, sizeof(struct ds_artist));
prev->next = artist;
}

Expand Down Expand Up @@ -480,9 +480,9 @@ bool xml_parse_browse_artist(struct artist_browse* a,
return true;
}

void xml_free_artist(struct artist *artist) {
struct artist* next_artist = artist;
for (struct artist* a = next_artist; next_artist; a = next_artist) {
void xml_free_artist(struct ds_artist *artist) {
struct ds_artist* next_artist = artist;
for (struct ds_artist* a = next_artist; next_artist; a = next_artist) {
next_artist = a->next;
free(a);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/xml.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ bool xml_parse_browse_album(struct ds_album_browse* a,

void xml_free_playlist(struct ds_playlist* pl);
void xml_free_track(struct ds_track* head);
void xml_free_artist(struct artist* artist);
void xml_free_artist(struct ds_artist* artist);
void xml_free_artist_browse(struct artist_browse* artist);
void xml_free_album(struct ds_album* album);
void xml_free_album_browse(struct ds_album_browse* album);
Expand Down

0 comments on commit aa0bb60

Please sign in to comment.