REFACTOR: Completely redid push_back and create
This commit is contained in:
+15
-15
@@ -8,29 +8,32 @@
|
||||
#ifndef CHAR_H
|
||||
#define CHAR_H
|
||||
|
||||
#define CAPACITY 1024
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <utils.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char* arr;
|
||||
size_t size;
|
||||
size_t capacity;
|
||||
size_t max_size;
|
||||
} Vec8_t;
|
||||
|
||||
__attribute__((overloadable)) Vec8_t
|
||||
create(const Vec8_t* input);
|
||||
|
||||
__attribute__((overloadable)) Vec8_t
|
||||
create(const _Bool init);
|
||||
Vec8_t
|
||||
create(const char* buf, const int len);
|
||||
|
||||
Vec8_t
|
||||
reserve(Vec8_t* ptr, size_t max_size);
|
||||
push_back(Vec8_t* vec, const char val);
|
||||
|
||||
Vec8_t
|
||||
pop_back(Vec8_t* vec);
|
||||
|
||||
Vec8_t
|
||||
reserve(Vec8_t* ptr, const size_t max_size);
|
||||
|
||||
Vec8_t
|
||||
shrink_to_fit(Vec8_t* ptr);
|
||||
@@ -41,10 +44,13 @@ swap(Vec8_t* ptr, Vec8_t* ptr_other);
|
||||
char*
|
||||
data(const Vec8_t* ptr);
|
||||
|
||||
size_t
|
||||
capacity(const Vec8_t* ptr);
|
||||
|
||||
size_t
|
||||
max_size(const Vec8_t* ptr);
|
||||
|
||||
void delete (Vec8_t* vec);
|
||||
void delete (const Vec8_t* vec);
|
||||
|
||||
Vec8_t
|
||||
clear(Vec8_t* vec);
|
||||
@@ -76,12 +82,6 @@ back(const Vec8_t* vec);
|
||||
int
|
||||
empty(const Vec8_t* vec);
|
||||
|
||||
Vec8_t
|
||||
add_back(Vec8_t* vec, char val);
|
||||
|
||||
Vec8_t
|
||||
pop_back(Vec8_t* vec);
|
||||
|
||||
__attribute__((overloadable)) Vec8_t
|
||||
resize(Vec8_t* vec, size_t size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user