Update: stdme/os module
This commit is contained in:
parent
dfb10f3390
commit
16f49181b5
37 changed files with 1201 additions and 345 deletions
|
|
@ -17,10 +17,10 @@
|
|||
#include "me/vec/vec_buf_str.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
t_vec_buf_str vec_buf_str_new(t_usize capacity,
|
||||
t_free_buf_str_item free_function)
|
||||
t_vec_buf_str vec_buf_str_new(t_usize capacity,
|
||||
t_free_buf_str_item free_function)
|
||||
{
|
||||
t_vec_buf_str out;
|
||||
t_vec_buf_str out;
|
||||
|
||||
out = (t_vec_buf_str){0};
|
||||
out.free_func = free_function;
|
||||
|
|
@ -31,10 +31,10 @@ t_vec_buf_str vec_buf_str_new(t_usize capacity,
|
|||
}
|
||||
|
||||
/// Return true in case of an error
|
||||
t_error vec_buf_str_push(t_vec_buf_str *vec, t_buffer_str element)
|
||||
t_error vec_buf_str_push(t_vec_buf_str *vec, t_buffer_str element)
|
||||
{
|
||||
t_buffer_str *temp_buffer;
|
||||
size_t new_capacity;
|
||||
t_buffer_str *temp_buffer;
|
||||
size_t new_capacity;
|
||||
|
||||
if (vec == NULL)
|
||||
return (ERROR);
|
||||
|
|
@ -57,10 +57,10 @@ t_error vec_buf_str_push(t_vec_buf_str *vec, t_buffer_str element)
|
|||
}
|
||||
|
||||
/// Return true in case of an error
|
||||
t_error vec_buf_str_reserve(t_vec_buf_str *vec, t_usize wanted_capacity)
|
||||
t_error vec_buf_str_reserve(t_vec_buf_str *vec, t_usize wanted_capacity)
|
||||
{
|
||||
t_buffer_str *temp_buffer;
|
||||
size_t new_capacity;
|
||||
t_buffer_str *temp_buffer;
|
||||
size_t new_capacity;
|
||||
|
||||
if (vec == NULL)
|
||||
return (ERROR);
|
||||
|
|
@ -82,10 +82,10 @@ t_error vec_buf_str_reserve(t_vec_buf_str *vec, t_usize wanted_capacity)
|
|||
|
||||
/// Return true if the vector is empty
|
||||
/// This function is safe to call with value being NULL
|
||||
t_error vec_buf_str_pop(t_vec_buf_str *vec, t_buffer_str *value)
|
||||
t_error vec_buf_str_pop(t_vec_buf_str *vec, t_buffer_str *value)
|
||||
{
|
||||
t_buffer_str temp_value;
|
||||
t_buffer_str *ptr;
|
||||
t_buffer_str temp_value;
|
||||
t_buffer_str *ptr;
|
||||
|
||||
if (vec == NULL)
|
||||
return (ERROR);
|
||||
|
|
@ -101,7 +101,7 @@ t_error vec_buf_str_pop(t_vec_buf_str *vec, t_buffer_str *value)
|
|||
}
|
||||
|
||||
/// This function is safe to call with `free_elem` being NULL
|
||||
void vec_buf_str_free(t_vec_buf_str vec)
|
||||
void vec_buf_str_free(t_vec_buf_str vec)
|
||||
{
|
||||
if (vec.free_func)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue