[dovecot-cvs] dovecot/src/plugins/zlib zlib-plugin.c,1.7,1.8
tss at dovecot.org
tss at dovecot.org
Thu Mar 29 14:51:23 EEST 2007
- Previous message: [dovecot-cvs] dovecot/src/plugins/trash Makefile.am,1.5,1.6
- Next message: [dovecot-cvs] dovecot/src/lib-storage mail-storage-private.h, 1.43, 1.44 mail-storage.c, 1.71, 1.72 mailbox-list-private.h, 1.3, 1.4 mailbox-list.c, 1.8, 1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/plugins/zlib
In directory talvi:/tmp/cvs-serv16171/plugins/zlib
Modified Files:
zlib-plugin.c
Log Message:
Better type safety to module_contexts arrays. Already fixed some bugs.
Index: zlib-plugin.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/zlib/zlib-plugin.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- zlib-plugin.c 15 Mar 2007 17:05:45 -0000 1.7
+++ zlib-plugin.c 29 Mar 2007 11:51:20 -0000 1.8
@@ -10,27 +10,22 @@
#include <fcntl.h>
-struct zlib_mail_storage {
- struct mail_storage_vfuncs super;
-};
-
#define ZLIB_CONTEXT(obj) \
- *((void **)array_idx_modifiable(&(obj)->module_contexts, \
- zlib_storage_module_id))
+ MODULE_CONTEXT(obj, zlib_storage_module)
const char *zlib_plugin_version = PACKAGE_VERSION;
static void (*zlib_next_hook_mail_storage_created)
(struct mail_storage *storage);
-static unsigned int zlib_storage_module_id = 0;
-static bool zlib_storage_module_id_set = FALSE;
+static MODULE_CONTEXT_DEFINE_INIT(zlib_storage_module,
+ &mail_storage_module_register);
static struct mailbox *
zlib_mailbox_open(struct mail_storage *storage, const char *name,
struct istream *input, enum mailbox_open_flags flags)
{
- struct zlib_mail_storage *qstorage = ZLIB_CONTEXT(storage);
+ union mail_storage_module_context *qstorage = ZLIB_CONTEXT(storage);
struct mailbox *box;
struct istream *zlib_input = NULL;
size_t len = strlen(name);
@@ -63,22 +58,16 @@
static void zlib_mail_storage_created(struct mail_storage *storage)
{
- struct zlib_mail_storage *qstorage;
+ union mail_storage_module_context *qstorage;
if (zlib_next_hook_mail_storage_created != NULL)
zlib_next_hook_mail_storage_created(storage);
- qstorage = p_new(storage->pool, struct zlib_mail_storage, 1);
+ qstorage = p_new(storage->pool, union mail_storage_module_context, 1);
qstorage->super = storage->v;
storage->v.mailbox_open = zlib_mailbox_open;
- if (!zlib_storage_module_id_set) {
- zlib_storage_module_id = mail_storage_module_id++;
- zlib_storage_module_id_set = TRUE;
- }
-
- array_idx_set(&storage->module_contexts,
- zlib_storage_module_id, &qstorage);
+ MODULE_CONTEXT_SET_SELF(storage, zlib_storage_module, qstorage);
}
void zlib_plugin_init(void)
- Previous message: [dovecot-cvs] dovecot/src/plugins/trash Makefile.am,1.5,1.6
- Next message: [dovecot-cvs] dovecot/src/lib-storage mail-storage-private.h, 1.43, 1.44 mail-storage.c, 1.71, 1.72 mailbox-list-private.h, 1.3, 1.4 mailbox-list.c, 1.8, 1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list