summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMukund Sivaraman <muks@banu.com>2009-11-17 01:52:23 +0530
committerMukund Sivaraman <muks@banu.com>2009-11-17 01:52:23 +0530
commitd7fada25e540c62f03dff9d763f4b4d55303d051 (patch)
tree4d70b9a0e654ee23b88fd55ea0d0543d1844b96b
parent4b6a25ac068e6dd686d1aae15f1d668b60c735c1 (diff)
downloadtinyproxy-d7fada25e540c62f03dff9d763f4b4d55303d051.tar.gz
tinyproxy-d7fada25e540c62f03dff9d763f4b4d55303d051.zip
Make position into an enum
-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;