REFACTOR: Completely rewrote insert and cleaned up names and redundant code.
31 lines
659 B
C
31 lines
659 B
C
#ifndef UTILS_H
|
|
#define UTILS_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#define CAPACITY 1024
|
|
#define SUCCESS 0
|
|
|
|
#define FAILURE 1
|
|
#define ERR_ALLOC_FAIL 20
|
|
#define ERR_BUF_NULL 21
|
|
#define ERR_BAD_TYPE 22
|
|
#define ERR_SIZE_ZERO 23
|
|
#define ERR_VECTOR_NULL 24
|
|
#define ERR_MAX_PASSED 25
|
|
#define ERR_OUT_OF_BOUNDS 26
|
|
|
|
extern const char* error_messages[];
|
|
|
|
#define LOG(msg) printf("LOG: %s\n", msg) /**< Print log message*/
|
|
#define LOGERROR(error_code) \
|
|
printf("ERROR: %s\n", \
|
|
error_messages[error_code]) /**< Print log error message*/
|
|
|
|
#define find_len(arr) sizeof(arr) / sizeof(arr[0])
|
|
|
|
static const size_t VEC_MAX = SIZE_MAX / sizeof(int);
|
|
|
|
#endif
|