ValidWebs is now a vector.
This commit is contained in:
+6
-6
@@ -29,7 +29,7 @@ using namespace dw::core;
|
||||
/*
|
||||
* Local data
|
||||
*/
|
||||
static Dlist *ValidWebs; /* Active web structures list; it holds
|
||||
static std::vector< DilloWeb * > ValidWebs; /* Active web structures list; it holds
|
||||
* pointers to DilloWeb structures. */
|
||||
|
||||
/*
|
||||
@@ -37,7 +37,6 @@ static Dlist *ValidWebs; /* Active web structures list; it holds
|
||||
*/
|
||||
void a_Web_init(void)
|
||||
{
|
||||
ValidWebs = dList_new(32);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,7 +133,7 @@ std::unique_ptr< DilloWeb > a_Web_new(BrowserWindow *bw, const DilloUrl *url,
|
||||
web->SavedBytes = 0;
|
||||
web->bgColor = 0x000000; /* Dummy value will be overwritten
|
||||
* in a_Web_dispatch_by_type. */
|
||||
dList_append(ValidWebs, (void *)web.get());
|
||||
ValidWebs.push_back( web.get() );
|
||||
return web;
|
||||
}
|
||||
|
||||
@@ -143,7 +142,7 @@ std::unique_ptr< DilloWeb > a_Web_new(BrowserWindow *bw, const DilloUrl *url,
|
||||
*/
|
||||
int a_Web_valid(DilloWeb *web)
|
||||
{
|
||||
return (dList_find(ValidWebs, web) != NULL);
|
||||
return std::find( begin( ValidWebs ), end( ValidWebs ), web ) != end( ValidWebs );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +150,8 @@ int a_Web_valid(DilloWeb *web)
|
||||
*/
|
||||
DilloWeb::~DilloWeb()
|
||||
{
|
||||
dList_remove(ValidWebs, (void *)this);
|
||||
_MSG("a_Web_free: ValidWebs=%d\n", dList_length(ValidWebs));
|
||||
auto where= std::find( begin( ValidWebs ), end( ValidWebs ), this );
|
||||
ValidWebs.erase( where );
|
||||
_MSG("a_Web_free: ValidWebs=%d\n", ValidWebs.size());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user