mirror of
https://github.com/3lswear/webserv.git
synced 2025-10-28 21:07:59 +03:00
feat: simplify parse control flow
This commit is contained in:
@@ -37,11 +37,12 @@ void Server::print_epoll_events(unsigned int events)
|
|||||||
//----------------------------------------------Configuration-----------------------------------------------------------------------------------
|
//----------------------------------------------Configuration-----------------------------------------------------------------------------------
|
||||||
void Server::readConfig(char *filename)
|
void Server::readConfig(char *filename)
|
||||||
{
|
{
|
||||||
TOMLMap *root = NULL;
|
// TOMLMap *root = NULL;
|
||||||
// root = parse(filename);
|
// root = parse(filename);
|
||||||
|
config::TOMLParser parser(filename);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
root = parse(filename);
|
parser.parse();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (std::domain_error &e)
|
catch (std::domain_error &e)
|
||||||
@@ -71,7 +72,7 @@ void Server::readConfig(char *filename)
|
|||||||
TOMLMapArray::iterator it;
|
TOMLMapArray::iterator it;
|
||||||
|
|
||||||
|
|
||||||
arr = root->find("server")->second->getMapArray();
|
arr = parser.root->find("server")->second->getMapArray();
|
||||||
it = arr->begin();
|
it = arr->begin();
|
||||||
|
|
||||||
while (it != arr->end())
|
while (it != arr->end())
|
||||||
|
|||||||
Reference in New Issue
Block a user