🔨」 fix: remove useless _table in class

This commit is contained in:
2025-04-14 13:37:25 +02:00
parent 5595a404d0
commit bff58bad92
2 changed files with 7 additions and 7 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/14 12:20:06 by adjoly #+# #+# */
/* Updated: 2025/04/14 12:55:46 by adjoly ### ########.fr */
/* Updated: 2025/04/14 13:36:42 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -27,7 +27,6 @@ class Config {
std::vector<Server *> *getServers(void) { return _servers; }
private:
toml::ANode *_table;
Logger *_log;
std::vector<Server *> *_servers;
};

View File

@ -6,10 +6,11 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/14 12:53:54 by adjoly #+# #+# */
/* Updated: 2025/04/14 13:32:56 by adjoly ### ########.fr */
/* Updated: 2025/04/14 13:36:46 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "node/ANode.hpp"
#include <config/default.hpp>
using namespace webserv::config;
@ -18,23 +19,23 @@ Config::Config(std::string &filename) {
toml::Toml *file = new toml::Toml(filename);
file->parse();
_table = file->getParsedFile();
toml::ANode *table = file->getParsedFile();
bool found = false;
void *logFile = _table->access("log_file", toml::STRING, found);
void *logFile = table->access("log_file", toml::STRING, found);
if (found == true && logFile != not_nullptr) {
_log = new Logger(*static_cast<std::string *>(logFile));
} else {
_log = new Logger();
}
std::map<std::string, toml::ANode *> *node = _table->getTable();
std::map<std::string, toml::ANode *> *node = table->getTable();
for (std::map<std::string, toml::ANode *>::iterator it = node->begin();
it != node->end(); it++) {
Server *srv = new Server(it->second, _log);
_servers->push_back(srv);
}
delete _table;
delete table;
delete file;
}