further camelcase fixing
[rrq/rrqmisc.git] / tests / example-vector.c
index 48403fcb106302ee50e0804c92c8f2d9c973f28b..62e79318e4f45cae9bc69730dca81da91605265b 100644 (file)
@@ -7,7 +7,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include "vector.h"
+#include "Vector.h"
 
 typedef struct _ipslot {
     int family;
@@ -16,7 +16,7 @@ typedef struct _ipslot {
 } ipslot;
 
 static struct {
-    vector data;
+    Vector data;
     int fill;
 } table;
 
@@ -99,9 +99,9 @@ static void add_entry(ipslot *tmp) {
     ipslot *p = (ipslot *) malloc( sizeof( ipslot ) );
     memmove( p, tmp, sizeof( ipslot ) );
     if ( table.data.size == table.fill ) {
-       (void) vector_resize( &table.data, table.fill + 256, 0, 0 );
+       (void) Vector_resize( &table.data, table.fill + 256, 0, 0 );
     }
-    vector_set( &table.data, table.fill++, p );
+    Vector_set( &table.data, table.fill++, p );
 }
 
 static void load_file(const char *filename) {
@@ -122,42 +122,40 @@ static void load_file(const char *filename) {
     }
 }
 
-static int int_reclaim(vector *pv,unsigned long index,void *item,void *data) {
+static int int_reclaim(Vector *pv,unsigned long index,void *item,void *data) {
     return 0;
 }
 
-static int dumpitem(const unsigned long index,const void *item) {
+static void dumpitem(const VectorIndex index,const void *item) {
     fprintf( stdout, "[%ld] %p\n", index, item );
-    return 0;
 }
 
-static int dump_ipslot(const unsigned long index,const void *item) {
+static void dump_ipslot(const VectorIndex index,const void *item) {
     static char buffer[100];
     ipslot *ip = (ipslot*) item;
     const char *p = inet_ntop( ip->family, ip->data, buffer, 100 );
     fprintf( stdout, "[%ld] %s/%d\n", index, p, ip->bits );
-    return 0;
 }
 
 int main(int argc,char **argv) {
-    vector test = { 0 };
-    vector_resize( &test, 100, 0, 0 );
-    vector_set( &test, 5, (void*) 500 );
-    vector_set( &test, 55, (void*) 600 );
-    vector_resize( &test, 300, 0, 0 );
-    vector_set( &test, 55, (void*) 650 );
-    vector_resize( &test, 30000, 0, 0 );
-    vector_set( &test, 22255, (void*) 26 );
-    vector_dump( &test, dumpitem );
-    vector_resize( &test, 100, int_reclaim, 0 );
-    vector_set( &test, 5, (void*) 2 );
-    vector_dump( &test, dumpitem );
+    Vector test = { 0 };
+    Vector_resize( &test, 100, 0, 0 );
+    Vector_set( &test, 5, (void*) 500 );
+    Vector_set( &test, 55, (void*) 600 );
+    Vector_resize( &test, 300, 0, 0 );
+    Vector_set( &test, 55, (void*) 650 );
+    Vector_resize( &test, 30000, 0, 0 );
+    Vector_set( &test, 22255, (void*) 26 );
+    Vector_dump( &test, dumpitem );
+    Vector_resize( &test, 100, int_reclaim, 0 );
+    Vector_set( &test, 5, (void*) 2 );
+    Vector_dump( &test, dumpitem );
 
     int i;
     for ( i = 1; i < argc; i++ ) {
        load_file( argv[ i ] );
     }
-    vector_dump( &table.data, dump_ipslot );
+    Vector_dump( &table.data, dump_ipslot );
 
     return 0;
 }