clean comment and stuff

This commit is contained in:
lperrey
2022-08-18 12:44:09 +02:00
parent 9b0fcc1520
commit 469eca8aa9
27 changed files with 100 additions and 325 deletions

View File

@@ -1,14 +1,6 @@
#include "utils.hpp"
void throw_test()
{
static int i = 0;
++i;
if (i % 8 == 0)
throw std::bad_alloc();
}
// notice : the use of getline make it such as
// it doesn't identify multiple delim as one :
// " something \n else " -> 1 - something
@@ -72,19 +64,6 @@ std::string trim(std::string str, char del)
return str;
}
//// trim a set of char
//std::string trim(std::string str, std::string del)
//{
// std::string new_str;
//
// while (new_str.compare(str) != 0)
// {
// for (size_t i = 0; i < del.size(); i++)
// trim(str, del[i]);
// }
// return str;
//}
std::string itos(int n)
{
std::stringstream strs;
@@ -93,7 +72,7 @@ std::string itos(int n)
return ( strs.str() );
}
bool isNumeric(std::string str)
bool is_numeric(std::string str)
{
for (size_t i = 0; i < str.length(); i++)
{
@@ -103,7 +82,7 @@ bool isNumeric(std::string str)
return true;
}
bool isNumeric_btw(int low, int high, std::string str)
bool is_numeric_btw(int low, int high, std::string str)
{
for (size_t i = 0; i < str.length(); i++)
{
@@ -155,7 +134,7 @@ file_type eval_file_type(const std::string &path)
{
struct stat s;
if (stat(path.c_str(), &s) != -1)
if (::stat(path.c_str(), &s) != -1)
{
if (S_ISREG(s.st_mode))
return (IS_FILE);
@@ -305,6 +284,15 @@ void str_map_key_tolower(std::map<std::string, std::string> & mp)
}
// DEBUG
void throw_test()
{
static int i = 0;
++i;
if (i % 8 == 0)
throw std::bad_alloc();
}
void print_special(std::string str)
{
char c;
@@ -318,10 +306,12 @@ void print_special(std::string str)
std::cout << YELLOW << "\\n" << RESET << "\n";
else
std::cout << c;
fflush(stdout);
std::fflush(stdout);
}
}
// OVERLOADS
bool operator==(const listen_socket& lhs, int fd)
{ return lhs.fd == fd; }