Who needs an extra enumerators ref counter when you already have a ref counter!?

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4808 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2003-09-25 13:12:53 +00:00
parent 6a740855a9
commit 849882f4f0
@@ -48,7 +48,6 @@ typedef struct module_addon {
char * path;
image_id addon_image; // if -1, not loaded in memory currently
module_info ** infos; // valid only when addon_image != -1
int32 enumerators;
} module_addon;
typedef struct module_list_cookie {
@@ -255,7 +254,7 @@ _EXPORT status_t read_next_module_name(void *cookie, char *buf, size_t *bufsize)
};
// We've iterate all module names of this module addon. Find another one...
atomic_add(&mlc->ma->enumerators, -1);
atomic_add(&mlc->ma->ref_count, -1);
unload_module_addon(mlc->ma);
mlc->ma = NULL;
mlc->mi = NULL;
@@ -320,7 +319,7 @@ _EXPORT status_t read_next_module_name(void *cookie, char *buf, size_t *bufsize)
// WTF it's doing there?!?
continue;
atomic_add(&mlc->ma->enumerators, 1);
atomic_add(&mlc->ma->ref_count, 1);
// call ourself to enter the module names list iteration at
// function begining code...
mlc->mi = mlc->ma->infos;
@@ -354,7 +353,7 @@ _EXPORT status_t close_module_list(void *cookie)
ASSERT(mlc->prefix);
if (mlc->ma) {
atomic_add(&mlc->ma->enumerators, -1);
atomic_add(&mlc->ma->ref_count, -1);
unload_module_addon(mlc->ma);
};
@@ -455,7 +454,6 @@ static module_addon * load_module_addon(const char * path)
LOCK_MODULES;
ma->ref_count = 0;
ma->enumerators = 0;
ma->keep_loaded = false;
ma->path = strdup(path);
ma->addon_image = addon_id;
@@ -546,9 +544,6 @@ static status_t unload_module_addon(module_addon * ma)
// built-in modules are addon-less, so nothing to do...
return B_OK;
if (ma->enumerators)
return B_OK;
if (ma->keep_loaded) {
printf("B_KEEP_LOADED flag set for %s module addon. Will be *never* unloaded!\n",
ma->path);