ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/src/module.C
(Generate patch)

Comparing cvsroot/ermyth/src/module.C (file contents):
Revision 1.6 by pippijn, Sun Sep 16 18:54:45 2007 UTC vs.
Revision 1.7 by pippijn, Sat Sep 22 14:27:30 2007 UTC

10 10
11modules::modules (impl::srcinf const &si, char const * const name, bool norestart, bool (*init)(module *), void (*fini)(), 11modules::modules (impl::srcinf const &si, char const * const name, bool norestart, bool (*init)(module *), void (*fini)(),
12 char const * const vendor, char const * const modversion) 12 char const * const vendor, char const * const modversion)
13{ 13{
14 if (provides (name)) 14 if (provides (name))
15 throw module_exception (si, "Trying to register two modules with the same name: %s", name); 15 throw module_exception (si, "Trying to register two modules with the same name: %s", name);
16 module *mod = new module (name, norestart, init, fini, vendor, modversion); 16 module *mod = new module (name, norestart, init, fini, vendor, modversion);
17 modlist ().push_back (mod); 17 modlist ().push_back (mod);
18 provides (name); 18 provides (name);
19} 19}
20 20
74} 74}
75 75
76void 76void
77modules::cleanup () 77modules::cleanup ()
78{ 78{
79 list_type::iterator it = modlist().begin (); 79 while (!modlist ().empty ())
80 list_type::iterator et = modlist().end (); 80 {
81 module *m = modlist ().back ();
81 82
82 while (--et != it)
83 {
84 module *m = *et;
85 if (m->enabled) 83 if (m->enabled)
86 m->fini (); 84 m->fini ();
87 delete m; 85 delete m;
86
87 modlist ().pop_back ();
88 } 88 }
89} 89}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines