aboutsummaryrefslogtreecommitdiff
path: root/src/shared/Config
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-17 16:20:24 -0700
committermaximius <none@none>2009-10-17 16:20:24 -0700
commit3f338cc1c328c7280957583b50598292cd8fb64b (patch)
treeca209c2cd024e3902b7844b3224bceff7c5bb570 /src/shared/Config
parente585187b248f48b3c6e9247b49fa07c6565d65e5 (diff)
*Massive cleanup redux.
--HG-- branch : trunk
Diffstat (limited to 'src/shared/Config')
-rw-r--r--src/shared/Config/Config.cpp2
-rw-r--r--src/shared/Config/dotconfpp/dotconfpp.cpp28
-rw-r--r--src/shared/Config/dotconfpp/dotconfpp.h1
-rw-r--r--src/shared/Config/dotconfpp/mempool.cpp7
-rw-r--r--src/shared/Config/dotconfpp/mempool.h1
5 files changed, 16 insertions, 23 deletions
diff --git a/src/shared/Config/Config.cpp b/src/shared/Config/Config.cpp
index b56b804b50a..1f37bce5227 100644
--- a/src/shared/Config/Config.cpp
+++ b/src/shared/Config/Config.cpp
@@ -27,13 +27,11 @@ Config::Config() : mIgnoreCase(true), mConf(NULL)
{
}
-
Config::~Config()
{
delete mConf;
}
-
bool Config::SetSource(const char *file, bool ignorecase)
{
mIgnoreCase = ignorecase;
diff --git a/src/shared/Config/dotconfpp/dotconfpp.cpp b/src/shared/Config/dotconfpp/dotconfpp.cpp
index e779637256e..8760b118e38 100644
--- a/src/shared/Config/dotconfpp/dotconfpp.cpp
+++ b/src/shared/Config/dotconfpp/dotconfpp.cpp
@@ -29,7 +29,7 @@ DOTCONFDocumentNode::~DOTCONFDocumentNode()
{
free(name);
if(values != NULL){
- for(int i = 0 ; i < valuesCount; i++){
+ for (int i = 0 ; i < valuesCount; i++){
free(values[i]);
}
free(values);
@@ -67,13 +67,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);
@@ -189,7 +189,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 == '<'){
@@ -218,7 +218,7 @@ int DOTCONFDocument::parseLine()
} else {
nodeName+=2;
std::list<DOTCONFDocumentNode*>::reverse_iterator itr=nodeTree.rbegin();
- for(; itr!=nodeTree.rend(); ++itr){
+ for (; itr!=nodeTree.rend(); ++itr){
if(!cmp_func(nodeName, (*itr)->name) && !(*itr)->closed){
(*itr)->closed = true;
curParent = (*itr)->parentNode;
@@ -307,7 +307,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);
@@ -371,7 +371,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;
@@ -386,7 +386,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;
@@ -419,7 +419,6 @@ int DOTCONFDocument::setContent(const char * _fileName)
}
}
-
if(!requiredOptions.empty())
ret = checkRequiredOptions();
}
@@ -429,9 +428,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;
@@ -499,7 +498,7 @@ char * DOTCONFDocument::getSubstitution(char * macro, int lineNum)
} else {
std::list<DOTCONFDocumentNode*>::iterator i = nodeTree.begin();
DOTCONFDocumentNode * tagNode = NULL;
- for(; i!=nodeTree.end(); i++){
+ for (; i!=nodeTree.end(); i++){
tagNode = *i;
if(!cmp_func(tagNode->name, variable)){
if(tagNode->valuesCount != 0){
@@ -566,7 +565,6 @@ const DOTCONFDocumentNode * DOTCONFDocument::getFirstNode() const
const DOTCONFDocumentNode * DOTCONFDocument::findNode(const char * nodeName, const DOTCONFDocumentNode * parentNode, const DOTCONFDocumentNode * startNode) const
{
-
std::list<DOTCONFDocumentNode*>::const_iterator i = nodeTree.begin();
if(startNode == NULL)
@@ -579,7 +577,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;
diff --git a/src/shared/Config/dotconfpp/dotconfpp.h b/src/shared/Config/dotconfpp/dotconfpp.h
index 51455854ee7..554b152f693 100644
--- a/src/shared/Config/dotconfpp/dotconfpp.h
+++ b/src/shared/Config/dotconfpp/dotconfpp.h
@@ -1,6 +1,5 @@
-
#ifndef DOTCONFPP_H
#define DOTCONFPP_H
diff --git a/src/shared/Config/dotconfpp/mempool.cpp b/src/shared/Config/dotconfpp/mempool.cpp
index cec8e8d119f..a23e33808bd 100644
--- a/src/shared/Config/dotconfpp/mempool.cpp
+++ b/src/shared/Config/dotconfpp/mempool.cpp
@@ -1,6 +1,5 @@
-
#include "mempool.h"
AsyncDNSMemPool::PoolChunk::PoolChunk(size_t _size):
@@ -22,7 +21,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 +52,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 +70,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;
diff --git a/src/shared/Config/dotconfpp/mempool.h b/src/shared/Config/dotconfpp/mempool.h
index 81c01d15a58..185b50798e1 100644
--- a/src/shared/Config/dotconfpp/mempool.h
+++ b/src/shared/Config/dotconfpp/mempool.h
@@ -1,6 +1,5 @@
-
#ifndef ASYNC_DNS_MEMPOOL_H
#define ASYNC_DNS_MEMPOOL_H