summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vector.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/vector.c b/src/vector.c
index a80eb4e..cf9fc75 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -104,10 +104,17 @@ int vector_delete (vector_t vector)
* Returns: 0 on success
* negative number if there are errors
*/
-#define INSERT_PREPEND 0
-#define INSERT_APPEND 1
-static int vector_insert (vector_t vector, void *data, size_t len, int pos)
+typedef enum {
+ INSERT_PREPEND,
+ INSERT_APPEND
+} vector_pos_t;
+
+static int
+vector_insert (vector_t vector,
+ void *data,
+ size_t len,
+ vector_pos_t pos)
{
struct vectorentry_s *entry;
@@ -133,7 +140,7 @@ static int vector_insert (vector_t vector, void *data, size_t len, int pos)
/* If there is no head or tail, create them */
if (!vector->head && !vector->tail)
vector->head = vector->tail = entry;
- else if (pos == 0) {
+ else if (pos == INSERT_PREPEND) {
/* prepend the entry */
entry->next = vector->head;
vector->head = entry;