From efe13ab833550f9236c111cee69fdce3c89f94fc Mon Sep 17 00:00:00 2001 From: Tanvir Ahmed Anas Date: Tue, 23 Jan 2024 18:42:30 +0400 Subject: [PATCH] chore(*.hpp): Moved error info to webserv.hpp and removed repeated includes --- includes/{error.hpp => debug.hpp} | 11 ----------- includes/webserv.hpp | 11 +++++++++++ parser/ConfigParser.hpp | 1 - server/socket/Socket.hpp | 3 +-- 4 files changed, 12 insertions(+), 14 deletions(-) rename includes/{error.hpp => debug.hpp} (77%) diff --git a/includes/error.hpp b/includes/debug.hpp similarity index 77% rename from includes/error.hpp rename to includes/debug.hpp index 394722b..4f81783 100644 --- a/includes/error.hpp +++ b/includes/debug.hpp @@ -39,15 +39,4 @@ # define DEBUGASSERT(x) do {} while (0) # endif // __DEBUG__ -/* ----------------------------- ERROR MESSAGES ----------------------------- */ -# include -static std::string ERR_NULL("Socket: null ptr error"); -static std::string ERR_CREAT("Socket: creation failed"); -static std::string ERR_BIND("Socket: binding failed"); -static std::string ERR_NBIND("Socket: not bound to a port"); -static std::string ERR_LIST("Socket: listen failed"); -static std::string ERR_NLIST("Socket: not listeing"); -static std::string ERR_ACCP("Socket: accept failed"); - - #endif // ERROR_HPP diff --git a/includes/webserv.hpp b/includes/webserv.hpp index 19de03a..fa5ffc1 100644 --- a/includes/webserv.hpp +++ b/includes/webserv.hpp @@ -1,7 +1,18 @@ #ifndef WEBSERV_HPP #define WEBSERV_HPP +/* -------------------------------- INCLUDES -------------------------------- */ #include +#include +#include "debug.hpp" +/* ----------------------------- ERROR MESSAGES ----------------------------- */ +static std::string ERR_NULL("Socket: null ptr error"); +static std::string ERR_CREAT("Socket: creation failed"); +static std::string ERR_BIND("Socket: binding failed"); +static std::string ERR_NBIND("Socket: not bound to a port"); +static std::string ERR_LIST("Socket: listen failed"); +static std::string ERR_NLIST("Socket: not listeing"); +static std::string ERR_ACCP("Socket: accept failed"); #endif // WEBSERV_HPP diff --git a/parser/ConfigParser.hpp b/parser/ConfigParser.hpp index 95fe2d9..019fd97 100644 --- a/parser/ConfigParser.hpp +++ b/parser/ConfigParser.hpp @@ -1,7 +1,6 @@ #ifndef CONFIG_PARSER_HPP #define CONFIG_PARSER_HPP -#include "../includes/error.hpp" #include "../includes/webserv.hpp" #include diff --git a/server/socket/Socket.hpp b/server/socket/Socket.hpp index 7f3d56c..1a89fd8 100644 --- a/server/socket/Socket.hpp +++ b/server/socket/Socket.hpp @@ -4,10 +4,9 @@ #include #include /* superset of previous */ #include -#include #include #include -#include "../../includes/error.hpp" +#include "../../includes/webserv.hpp" // TODO // [P]artially implemented, needs [I]mprovement, [X] done //