diff options
author | Timo Sirainen <cras@irssi.org> | 2000-08-30 22:29:55 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-08-30 22:29:55 +0000 |
commit | b4bdec4436190d7ccb6252be388b5ee70c5c36f5 (patch) | |
tree | 5b80eb0eab42f347575c05dbff3361f9955cd6ee /src/core/modules.h | |
parent | cf7eb945ea769b51622a1c1cbbbc7e7a6a494df9 (diff) | |
download | irssi-b4bdec4436190d7ccb6252be388b5ee70c5c36f5.zip |
Object type checking fixes
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@638 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/modules.h')
-rw-r--r-- | src/core/modules.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/core/modules.h b/src/core/modules.h index 6ced5387..118e790c 100644 --- a/src/core/modules.h +++ b/src/core/modules.h @@ -1,6 +1,18 @@ #ifndef __MODULES_H #define __MODULES_H +#define MODULE_DATA_INIT(rec) \ + (rec)->module_data = g_hash_table_new(g_str_hash, g_str_equal) + +#define MODULE_DATA_DEINIT(rec) \ + g_hash_table_destroy((rec)->module_data) + +#define MODULE_DATA_SET(rec, data) \ + g_hash_table_insert((rec)->module_data, MODULE_NAME, data) + +#define MODULE_DATA(rec) \ + g_hash_table_lookup((rec)->module_data, MODULE_NAME) + enum { MODULE_ERROR_ALREADY_LOADED, MODULE_ERROR_LOAD, @@ -19,17 +31,9 @@ MODULE_REC *module_find(const char *name); int module_load(const char *path); void module_unload(MODULE_REC *module); -#define MODULE_DATA_INIT(rec) \ - (rec)->module_data = g_hash_table_new(g_str_hash, g_str_equal) - -#define MODULE_DATA_DEINIT(rec) \ - g_hash_table_destroy((rec)->module_data) - -#define MODULE_DATA_SET(rec, data) \ - g_hash_table_insert((rec)->module_data, MODULE_NAME, data) - -#define MODULE_DATA(rec) \ - g_hash_table_lookup((rec)->module_data, MODULE_NAME) +#define MODULE_CHECK_CAST(object, cast, type_field, id) \ + ((cast *) module_check_cast(object, offsetof(cast, type_field), id)) +void *module_check_cast(void *object, int type_pos, const char *id); /* return unique number across all modules for `id' */ int module_get_uniq_id(const char *module, int id); |