commit ae2d270f2276886cb5edb03a8446f9928c4c81ef
parent 38fa6c1f492b8d61c41a6c79309d29841d23bdb4
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Thu, 6 Apr 2006 10:39:49 +0200
cleaned up vector definition
Diffstat:
3 files changed, 15 insertions(+), 44 deletions(-)
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -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;
diff --git a/cmd/wmiimenu.c b/cmd/wmiimenu.c
@@ -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];
diff --git a/libcext/cext.h b/libcext/cext.h
@@ -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);