From 2132f4fd9035ef87f16c9d7e48948b8e2ed11ba5 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Fri, 18 Nov 2011 20:43:26 +0100 Subject: [PATCH] another change on class definition macro --- include/token/cclass.h | 6 ++++-- include/token/crypt.h | 6 +++--- include/token/dyntype.h | 5 +++-- include/token/dyntype/hash.h | 5 +++-- include/token/packet.h | 5 +++-- tests/mock/class.h | 5 +++-- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/token/cclass.h b/include/token/cclass.h index 86681c3..cf1cf3d 100644 --- a/include/token/cclass.h +++ b/include/token/cclass.h @@ -27,8 +27,10 @@ #define CCLASS_MAGIC 0xFEFE #define CLASS(_class) \ - typedef struct _##_class { \ - const _CCLASS const class; + struct _##_class; \ + typedef struct _##_class * _class; \ + extern const _CCLASS const __##_class; \ + struct _##_class #define ENDC(_class) } * _class; \ extern const _CCLASS const __##_class; diff --git a/include/token/crypt.h b/include/token/crypt.h index faf4a8d..f9d3a83 100644 --- a/include/token/crypt.h +++ b/include/token/crypt.h @@ -23,15 +23,15 @@ #include "token/cclass.h" -CLASS(CRYPT) +CLASS(CRYPT) { + const _CCLASS const class; const char * algorithm; const char * mode; MCRYPT mcrypt; size_t ivsize; size_t keysize; void * iv; -ENDC(CRYPT) - +}; void * crypt_encrypt( CRYPT _this, diff --git a/include/token/dyntype.h b/include/token/dyntype.h index 3e6b73c..c6e60f1 100644 --- a/include/token/dyntype.h +++ b/include/token/dyntype.h @@ -37,7 +37,8 @@ enum DYNTYPE_TYPES { }; -CLASS(DYNTYPE) +CLASS(DYNTYPE) { + const _CCLASS const class; enum DYNTYPE_TYPES type; size_t size; union _data { @@ -48,7 +49,7 @@ CLASS(DYNTYPE) struct _DYNTYPE ** _array; DYNTYPE_HASH _hash; } data; -ENDC(DYNTYPE) +}; #include "token/dyntype/hash.h" diff --git a/include/token/dyntype/hash.h b/include/token/dyntype/hash.h index 02e3455..d555aad 100644 --- a/include/token/dyntype/hash.h +++ b/include/token/dyntype/hash.h @@ -30,12 +30,13 @@ struct _DYNTYPE_HASH; #undef DYNTYPE_HASH #define __DYNTYPE_HASH_H__ -CLASS(DYNTYPE_HASH) +CLASS(DYNTYPE_HASH) { + const _CCLASS const class; char ** keys; DYNTYPE * values; size_t size; size_t used; -ENDC(DYNTYPE_HASH) +}; void dyntype_hash_set(DYNTYPE_HASH _this, const char * key, struct _DYNTYPE * value); diff --git a/include/token/packet.h b/include/token/packet.h index 905ee39..15a0e53 100644 --- a/include/token/packet.h +++ b/include/token/packet.h @@ -28,9 +28,10 @@ enum PACKET_CONTENT_KEYS { }; -CLASS(PACKET) +CLASS(PACKET) { + const _CCLASS const class; DYNTYPE content[2]; -ENDC(PACKET) +}; DYNTYPE packet_getHeader(PACKET _this); diff --git a/tests/mock/class.h b/tests/mock/class.h index c34d513..98d9214 100644 --- a/tests/mock/class.h +++ b/tests/mock/class.h @@ -16,9 +16,10 @@ _reset() #endif//_RESET -CLASS(MOCK_CLASS) +CLASS(MOCK_CLASS) { + const _CCLASS const class; int value; -ENDC(MOCK_CLASS) +}; extern const _CCLASS const __MOCK_CLASS;