update stuff
This commit is contained in:
parent
5973022688
commit
544ed8b045
194 changed files with 2060 additions and 1464 deletions
|
|
@ -6,18 +6,18 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/04 18:32:50 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/05/18 18:44:24 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/05/19 14:55:56 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "app/env.h"
|
||||
#include "me/buffered_str/buf_str.h"
|
||||
#include "me/string/string.h"
|
||||
#include "me/hash/hasher.h"
|
||||
#include "me/hashmap/hashmap_env.h"
|
||||
#include "me/mem/mem.h"
|
||||
#include "me/string/str_clone.h"
|
||||
#include "me/string/str_compare.h"
|
||||
#include "me/string/str_len.h"
|
||||
#include "me/str/str.h"
|
||||
#include "me/str/str.h"
|
||||
#include "me/str/str.h"
|
||||
#include "me/types.h"
|
||||
#include "me/vec/vec_str.h"
|
||||
#include <stdlib.h>
|
||||
|
|
@ -47,7 +47,7 @@ static void _free_env(t_kv_env kv)
|
|||
|
||||
t_hashmap_env *create_env_map(void)
|
||||
{
|
||||
return (new_hashmap_env(_hash_str, _cmp_str, _free_env));
|
||||
return (hmap_new_env(_hash_str, _cmp_str, _free_env));
|
||||
}
|
||||
|
||||
t_error _build_envp_iterator(t_usize idx, const t_str *key, t_str *val,
|
||||
|
|
@ -58,13 +58,13 @@ t_error _build_envp_iterator(t_usize idx, const t_str *key, t_str *val,
|
|||
|
||||
(void)(idx);
|
||||
s = ctx;
|
||||
if (push_str_buffer(&s->buf, *key) || push_str_buffer(&s->buf, "=") ||
|
||||
push_str_buffer(&s->buf, *val))
|
||||
if (string_push(&s->buf, *key) || string_push(&s->buf, "=") ||
|
||||
string_push(&s->buf, *val))
|
||||
return (vec_str_free(s->out), ERROR);
|
||||
push = str_clone(s->buf.buf);
|
||||
if (vec_str_push(&s->out, push))
|
||||
return (str_free(s->buf), ERROR);
|
||||
str_clear(&s->buf);
|
||||
return (string_free(s->buf), ERROR);
|
||||
string_clear(&s->buf);
|
||||
return (NO_ERROR);
|
||||
}
|
||||
|
||||
|
|
@ -72,13 +72,13 @@ t_error build_envp(t_hashmap_env *envs, t_vec_str *envp)
|
|||
{
|
||||
struct s_build_envp_state state;
|
||||
|
||||
state.buf = alloc_new_buffer(8096);
|
||||
state.buf = string_new(8096);
|
||||
state.out = vec_str_new(1024, (void (*)(t_str))mem_free);
|
||||
if (hashmap_env_iter(envs, _build_envp_iterator, &state))
|
||||
return (str_free(state.buf), printf("iter failed\n"), ERROR);
|
||||
if (hmap_env_iter(envs, _build_envp_iterator, &state))
|
||||
return (string_free(state.buf), ERROR);
|
||||
if (vec_str_push(&state.out, NULL))
|
||||
return (str_free(state.buf), printf("coun't push null\n"), ERROR);
|
||||
return (string_free(state.buf), ERROR);
|
||||
*envp = state.out;
|
||||
str_free(state.buf);
|
||||
string_free(state.buf);
|
||||
return (NO_ERROR);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue