From 849882f4f0c6e583e24fbdf2ceca79bc91b089ca Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Thu, 25 Sep 2003 13:12:53 +0000 Subject: [PATCH] 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 --- src/tests/kits/net/new_stack/userland_modules.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/tests/kits/net/new_stack/userland_modules.cpp b/src/tests/kits/net/new_stack/userland_modules.cpp index b719d464cc..d811326ea8 100644 --- a/src/tests/kits/net/new_stack/userland_modules.cpp +++ b/src/tests/kits/net/new_stack/userland_modules.cpp @@ -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);