Added env hashmap with build_env function to build envp

This commit is contained in:
Maix0 2024-05-04 19:21:56 +02:00
parent f35e986145
commit f86947a852
54 changed files with 2010 additions and 105 deletions

20
stdme/src/hash/hash_str.c Normal file
View file

@ -0,0 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* hash_str.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/04 19:17:11 by maiboyer #+# #+# */
/* Updated: 2024/05/04 19:18:26 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "me/hash/hasher.h"
#include "me/string/str_len.h"
#include "me/types.h"
void hasher_write_str(t_hasher *hasher, t_str s)
{
hasher_write_bytes(hasher, (t_u8 *)s, str_len(s));
}

View file

@ -0,0 +1,26 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* str_compare.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/04 18:53:47 by maiboyer #+# #+# */
/* Updated: 2024/05/04 18:37:40 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "me/string/str_compare.h"
// PLEASE FIX THIS FUNCTION IF NEEDED !
bool str_compare(t_const_str lhs, t_const_str rhs)
{
t_usize index;
if (lhs == NULL || rhs == NULL)
return (lhs == rhs);
index = 0;
while (lhs[index] && rhs[index] && lhs[index] == rhs[index])
index++;
return ((t_i32)(t_u8)lhs[index] - (t_i32)(t_u8)rhs[index]);
}