#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include "vector.h"
+#include "Vector.h"
typedef struct _ipslot {
int family;
} ipslot;
static struct {
- vector data;
+ Vector data;
int fill;
} table;
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) {
}
}
-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 void dumpitem(const vector_index index,const void *item) {
+static void dumpitem(const VectorIndex index,const void *item) {
fprintf( stdout, "[%ld] %p\n", index, item );
}
-static void dump_ipslot(const vector_index 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 );
}
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;
}