minishell/stdme/src/string/string_reserve.c
2024-07-10 18:06:10 +02:00

25 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* string_reserve.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/08 22:02:49 by maiboyer #+# #+# */
/* Updated: 2024/07/10 18:01:40 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "me/mem/mem.h"
#include "me/string/string.h"
#include "me/types.h"
t_error string_reserve(t_string *self, t_usize capacity)
{
if (self == NULL)
return (ERROR);
if (self->capacity >= capacity)
return (NO_ERROR);
self->buf = mem_realloc(self->buf, capacity);
return (NO_ERROR);
}