aboutsummaryrefslogtreecommitdiffstats
path: root/src/queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/queue.c')
-rw-r--r--src/queue.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/queue.c b/src/queue.c
index 141222a80..bd89544ca 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -17,6 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "config.h"
#include "queue.h"
#include "song.h"
@@ -33,7 +34,7 @@ queue_generate_id(const struct queue *queue)
if (cur >= queue->max_length * QUEUE_HASH_MULT)
cur = 0;
- } while (queue->idToPosition[cur] != -1);
+ } while (queue->id_to_position[cur] != -1);
return cur;
}
@@ -111,7 +112,7 @@ queue_append(struct queue *queue, struct song *song)
};
queue->order[queue->length] = queue->length;
- queue->idToPosition[id] = queue->length;
+ queue->id_to_position[id] = queue->length;
++queue->length;
@@ -132,8 +133,8 @@ queue_swap(struct queue *queue, unsigned position1, unsigned position2)
queue->items[position1].version = queue->version;
queue->items[position2].version = queue->version;
- queue->idToPosition[id1] = position2;
- queue->idToPosition[id2] = position1;
+ queue->id_to_position[id1] = position2;
+ queue->id_to_position[id2] = position1;
}
static void
@@ -143,7 +144,7 @@ queue_move_song_to(struct queue *queue, unsigned from, unsigned to)
queue->items[to] = queue->items[from];
queue->items[to].version = queue->version;
- queue->idToPosition[from_id] = to;
+ queue->id_to_position[from_id] = to;
}
void
@@ -163,7 +164,7 @@ queue_move(struct queue *queue, unsigned from, unsigned to)
/* put song at _to_ */
- queue->idToPosition[item.id] = to;
+ queue->id_to_position[item.id] = to;
queue->items[to] = item;
queue->items[to].version = queue->version;
@@ -203,7 +204,7 @@ queue_move_range(struct queue *queue, unsigned start, unsigned end, unsigned to)
// Copy the original block back in, starting at to.
for (unsigned i = start; i< end; i++)
{
- queue->idToPosition[items[i-start].id] = to + i - start;
+ queue->id_to_position[items[i-start].id] = to + i - start;
queue->items[to + i - start] = items[i-start];
queue->items[to + i - start].version = queue->version;
}
@@ -243,7 +244,7 @@ queue_delete(struct queue *queue, unsigned position)
/* release the song id */
- queue->idToPosition[id] = -1;
+ queue->id_to_position[id] = -1;
/* delete song from songs array */
@@ -271,7 +272,7 @@ queue_clear(struct queue *queue)
if (!song_in_database(item->song))
song_free(item->song);
- queue->idToPosition[item->id] = -1;
+ queue->id_to_position[item->id] = -1;
}
queue->length = 0;
@@ -291,11 +292,11 @@ queue_init(struct queue *queue, unsigned max_length)
queue->items = g_new(struct queue_item, max_length);
queue->order = g_malloc(sizeof(queue->order[0]) *
max_length);
- queue->idToPosition = g_malloc(sizeof(queue->idToPosition[0]) *
+ queue->id_to_position = g_malloc(sizeof(queue->id_to_position[0]) *
max_length * QUEUE_HASH_MULT);
for (unsigned i = 0; i < max_length * QUEUE_HASH_MULT; ++i)
- queue->idToPosition[i] = -1;
+ queue->id_to_position[i] = -1;
queue->rand = g_rand_new();
}
@@ -307,7 +308,7 @@ queue_finish(struct queue *queue)
g_free(queue->items);
g_free(queue->order);
- g_free(queue->idToPosition);
+ g_free(queue->id_to_position);
g_rand_free(queue->rand);
}