add check for sizeof(off_t) to MODULE_VERSION_CHECK()

personal/stbuehler/wip
Thomas Porzelt 15 years ago
parent 55dd7e3060
commit bf549bbe0d

@ -5,10 +5,15 @@
#define MODULE_VERSION ((guint) 0x00000001)
#define MODULE_VERSION_CHECK(mods) do { \
if (mods->version != MODULE_VERSION) { \
ERROR(mods->main, "Version mismatch for modules system: is %u, expected %u", mods->version, MODULE_VERSION); \
return FALSE; \
} } while(0)
if (mods->version != MODULE_VERSION) { \
ERROR(mods->main, "Version mismatch for modules system: is %u, expected %u", mods->version, MODULE_VERSION); \
return FALSE; \
} \
if (mods->sizeof_off_t != (guint8)sizeof(off_t)) { \
ERROR(mods->main, "Compile flags mismatch: sizeof(off_t) is %u, expected %u", (guint) sizeof(off_t), mods->sizeof_off_t); \
return FALSE; \
} \
} while(0)
/** see module_load */
#define MODULE_DEPENDS(mods, name) do { \
@ -43,6 +48,8 @@ struct modules {
gpointer main; /**< pointer to a application specific main structure, e.g. server */
GArray *mods; /**< array of (module*) */
gchar *module_dir;
guint8 sizeof_off_t; /** holds the value of sizeof(off_t) to check if loaded module was compiled with the same flags */
};
LI_API modules* modules_init(gpointer main, const gchar *module_dir);

@ -8,6 +8,7 @@ modules *modules_init(gpointer main, const gchar *module_dir) {
m->main = main;
m->mods = g_array_new(FALSE, TRUE, sizeof(module*));
m->module_dir = g_strdup(module_dir);
m->sizeof_off_t = sizeof(off_t);
return m;
}

Loading…
Cancel
Save