* Small speedups in mempool/dotconfpp.
--HG-- branch : trunk
This commit is contained in:
@@ -55,13 +55,13 @@ DOTCONFDocument::DOTCONFDocument(DOTCONFDocument::CaseSensitive caseSensitivity)
|
||||
|
||||
DOTCONFDocument::~DOTCONFDocument()
|
||||
{
|
||||
for(std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i != nodeTree.end(); i++){
|
||||
for(std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i != nodeTree.end(); ++i){
|
||||
delete(*i);
|
||||
}
|
||||
for(std::list<char*>::iterator i = requiredOptions.begin(); i != requiredOptions.end(); i++){
|
||||
for(std::list<char*>::iterator i = requiredOptions.begin(); i != requiredOptions.end(); ++i){
|
||||
free(*i);
|
||||
}
|
||||
for(std::list<char*>::iterator i = processedFiles.begin(); i != processedFiles.end(); i++){
|
||||
for(std::list<char*>::iterator i = processedFiles.begin(); i != processedFiles.end(); ++i){
|
||||
free(*i);
|
||||
}
|
||||
free(fileName);
|
||||
@@ -177,7 +177,7 @@ int DOTCONFDocument::parseLine()
|
||||
DOTCONFDocumentNode * tagNode = NULL;
|
||||
bool newNode = false;
|
||||
|
||||
for(std::list<char*>::iterator i = words.begin(); i != words.end(); i++) {
|
||||
for(std::list<char*>::iterator i = words.begin(); i != words.end(); ++i) {
|
||||
word = *i;
|
||||
|
||||
if(*word == '<'){
|
||||
@@ -295,7 +295,7 @@ int DOTCONFDocument::checkConfig(const std::list<DOTCONFDocumentNode*>::iterator
|
||||
|
||||
DOTCONFDocumentNode * tagNode = NULL;
|
||||
int vi = 0;
|
||||
for(std::list<DOTCONFDocumentNode*>::iterator i = from; i != nodeTree.end(); i++){
|
||||
for(std::list<DOTCONFDocumentNode*>::iterator i = from; i != nodeTree.end(); ++i){
|
||||
tagNode = *i;
|
||||
if(!tagNode->closed){
|
||||
error(tagNode->lineNum, tagNode->fileName, "unclosed tag %s", tagNode->name);
|
||||
@@ -359,7 +359,7 @@ int DOTCONFDocument::setContent(const char * _fileName)
|
||||
std::list<DOTCONFDocumentNode*>::iterator from;
|
||||
DOTCONFDocumentNode * tagNode = NULL;
|
||||
int vi = 0;
|
||||
for(std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i!=nodeTree.end(); i++){
|
||||
for(std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i!=nodeTree.end(); ++i){
|
||||
tagNode = *i;
|
||||
if(!cmp_func("DOTCONFPPIncludeFile", tagNode->name)){
|
||||
vi = 0;
|
||||
@@ -374,7 +374,7 @@ int DOTCONFDocument::setContent(const char * _fileName)
|
||||
}
|
||||
|
||||
bool processed = false;
|
||||
for(std::list<char*>::const_iterator itInode = processedFiles.begin(); itInode != processedFiles.end(); itInode++){
|
||||
for(std::list<char*>::const_iterator itInode = processedFiles.begin(); itInode != processedFiles.end(); ++itInode){
|
||||
if(!strcmp(*itInode, realpathBuf)){
|
||||
processed = true;
|
||||
break;
|
||||
@@ -417,9 +417,9 @@ int DOTCONFDocument::setContent(const char * _fileName)
|
||||
|
||||
int DOTCONFDocument::checkRequiredOptions()
|
||||
{
|
||||
for(std::list<char*>::const_iterator ci = requiredOptions.begin(); ci != requiredOptions.end(); ci++){
|
||||
for(std::list<char*>::const_iterator ci = requiredOptions.begin(); ci != requiredOptions.end(); ++ci){
|
||||
bool matched = false;
|
||||
for(std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i!=nodeTree.end(); i++){
|
||||
for(std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin(); i!=nodeTree.end(); ++i){
|
||||
if(!cmp_func((*i)->name, *ci)){
|
||||
matched = true;
|
||||
break;
|
||||
@@ -567,7 +567,7 @@ const DOTCONFDocumentNode * DOTCONFDocument::findNode(const char * nodeName, con
|
||||
if( i != nodeTree.end() ) ++i;
|
||||
}
|
||||
|
||||
for(; i!=nodeTree.end(); i++){
|
||||
for(; i!=nodeTree.end(); ++i){
|
||||
|
||||
if((*i)->parentNode != parentNode){
|
||||
continue;
|
||||
|
||||
@@ -22,7 +22,7 @@ AsyncDNSMemPool::AsyncDNSMemPool(size_t _defaultSize):
|
||||
|
||||
AsyncDNSMemPool::~AsyncDNSMemPool()
|
||||
{
|
||||
for(size_t i = 0; i<chunksCount; i++){
|
||||
for(size_t i = 0; i<chunksCount; ++i){
|
||||
delete chunks[i];
|
||||
}
|
||||
::free(chunks);
|
||||
@@ -53,7 +53,7 @@ void AsyncDNSMemPool::addNewChunk(size_t size)
|
||||
void * AsyncDNSMemPool::alloc(size_t size)
|
||||
{
|
||||
PoolChunk * chunk = NULL;
|
||||
for(size_t i = 0; i<chunksCount; i++){
|
||||
for(size_t i = 0; i<chunksCount; ++i){
|
||||
chunk = chunks[i];
|
||||
if((chunk->size - chunk->pos) >= size){
|
||||
chunk->pos += size;
|
||||
@@ -71,7 +71,7 @@ void AsyncDNSMemPool::free()
|
||||
size_t psz = 0;
|
||||
++poolUsageCounter;
|
||||
|
||||
for(size_t i = 0; i<chunksCount; i++){
|
||||
for(size_t i = 0; i<chunksCount; ++i){
|
||||
pu += chunks[i]->pos;
|
||||
psz += chunks[i]->size;
|
||||
chunks[i]->pos = 0;
|
||||
|
||||
Reference in New Issue
Block a user