From 9ae6ad183b50e2d5ae97bd4216be53a2993f654c Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Sun, 21 Jan 2024 12:31:52 +0100 Subject: [PATCH] BRAAAAAAAAAAAAAAAPAPAPAPAPAAAAPPAAPAPAPA --- includes/unstd/shared_ptr.hpp | 3 +-- includes/unstd/shared_ptr.ipp | 24 ++---------------------- srcs/main.cpp | 4 ++-- srcs/server.cpp | 17 ++++++++++++++++- 4 files changed, 21 insertions(+), 27 deletions(-) diff --git a/includes/unstd/shared_ptr.hpp b/includes/unstd/shared_ptr.hpp index a80a7f5..98400d7 100644 --- a/includes/unstd/shared_ptr.hpp +++ b/includes/unstd/shared_ptr.hpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/20 10:09:02 by maldavid #+# #+# */ -/* Updated: 2024/01/20 19:12:42 by maldavid ### ########.fr */ +/* Updated: 2024/01/21 12:27:07 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -43,7 +43,6 @@ namespace unstd void safeRelease(); private: - static std::map _refs; T* _ptr; bits::RefCount* _ref; }; diff --git a/includes/unstd/shared_ptr.ipp b/includes/unstd/shared_ptr.ipp index 011489b..80880b9 100644 --- a/includes/unstd/shared_ptr.ipp +++ b/includes/unstd/shared_ptr.ipp @@ -15,17 +15,7 @@ namespace unstd template SharedPtr::SharedPtr(T* ptr) : _ptr(ptr) { - typename std::map::iterator it = _refs.find(static_cast(ptr)); - if(it == _refs.end()) - { - _ref = new bits::RefCount(1, 0); - _refs[static_cast(ptr)] = _ref; - } - else - { - _ref = it->second; - _ref->shared++; - } + _ref = new bits::RefCount(1, 0); } template @@ -100,17 +90,7 @@ namespace unstd { safeRelease(); _ptr = ptr; - typename std::map::iterator it = _refs.find(static_cast(ptr)); - if(it == _refs.end()) - { - _ref = new bits::RefCount(1, 0); - _refs[static_cast(ptr)] = _ref; - } - else - { - _ref = it->second; - _ref->shared++; - } + _ref = new bits::RefCount(1, 0); } template diff --git a/srcs/main.cpp b/srcs/main.cpp index 269a18a..abe5d1b 100644 --- a/srcs/main.cpp +++ b/srcs/main.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/20 09:27:04 by maldavid #+# #+# */ -/* Updated: 2024/01/21 10:31:26 by maldavid ### ########.fr */ +/* Updated: 2024/01/21 12:16:41 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,7 +26,7 @@ int main(int ac, char** av) } if(av[1] == NULL || av[2] == NULL) - irc::logs::report(irc::log_fatal_error, "invalid argv, one is NULL (wtf)"); + irc::logs::report(irc::log_fatal_error, "invalid argv, argv[1] or argv[2] is NULL (wtf)"); char* end; long port = std::strtol(av[1], &end, 10); diff --git a/srcs/server.cpp b/srcs/server.cpp index 43f85a9..1772652 100644 --- a/srcs/server.cpp +++ b/srcs/server.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/21 09:31:17 by maldavid #+# #+# */ -/* Updated: 2024/01/21 10:38:12 by maldavid ### ########.fr */ +/* Updated: 2024/01/21 12:13:51 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,21 @@ #include #include +/** Commands to handle + * NICK + * USER + * QUIT + * PART + * JOIN + * PRIVMSG + * NOTICE + * KICK + * MOTD + * TOPIC + * PING + * MODE + */ + namespace irc { Server::Server(int port, const std::string& password) : _password(password), _port(port)