cleaned up vector definition

This commit is contained in:
Anselm R. Garbe 2006-04-06 10:39:49 +02:00
parent 38fa6c1f49
commit ae2d270f22
3 changed files with 15 additions and 44 deletions

View File

@ -73,11 +73,7 @@ typedef struct Area Area;
typedef struct Frame Frame;
typedef struct Client Client;
typedef struct {
unsigned int size;
Area **data;
} AreaVector;
VECTOR(AreaVector, Area *);
struct View {
char name[MAX_TAGLEN];
unsigned short id;
@ -86,11 +82,7 @@ struct View {
unsigned int revert;
};
typedef struct {
unsigned int size;
Frame **data;
} FrameVector;
VECTOR(FrameVector, Frame *);
struct Area {
unsigned short id;
FrameVector frame;
@ -163,31 +155,11 @@ typedef struct {
} Default;
/* global variables */
typedef struct {
unsigned int size;
View **data;
} ViewVector;
typedef struct {
unsigned int size;
Client **data;
} ClientVector;
typedef struct {
unsigned int size;
Key **data;
} KeyVector;
typedef struct {
unsigned int size;
Label **data;
} LabelVector;
LabelVector label;
typedef struct {
unsigned int size;
char **data;
} TagVector;
VECTOR(ViewVector, View *);
VECTOR(ClientVector, Client *);
VECTOR(KeyVector, Key *);
VECTOR(LabelVector, Label *);
VECTOR(TagVector, char *);
/* global variables */
ViewVector view;
@ -195,6 +167,7 @@ unsigned int sel;
ClientVector client;
TagVector tag;
KeyVector key;
LabelVector label;
Display *dpy;
int screen;
Window root;

View File

@ -20,11 +20,7 @@
#include <blitz.h>
#include <cext.h>
typedef struct {
unsigned int size;
char **data;
} ItemVector;
VECTOR(ItemVector, char *);
static Bool done = False;
static int ret = 0;
static char text[4096];

View File

@ -29,10 +29,12 @@ long long cext_strtonum(const char *numstr, long long minval,
unsigned int cext_tokenize(char **result, unsigned int reslen, char *str, char delim);
/* vector.c */
typedef struct {
unsigned int size;
void **data;
} Vector;
#define VECTOR(name, type) \
typedef struct { \
unsigned int size; \
type *data; \
} name
VECTOR(Vector, void *);
void cext_vattach(Vector *v, void *p);
void cext_vdetach(Vector *v, void *p);