updated some stuff
This commit is contained in:
@@ -2,7 +2,62 @@
|
||||
#define INTERNAL_MARIGOLD_VECTOR_H
|
||||
|
||||
|
||||
struct vector_struct* vector_initialize();
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef enum
|
||||
vector_flag_enum
|
||||
{
|
||||
vector_multithread_safe = 1 << 0,
|
||||
vector_read_only = 1 << 1,
|
||||
vector_certainly_sorted = 1 << 2,
|
||||
vector_marked_for_free = 1 << 3,
|
||||
vector_debug_has_function_call_rolled_over = 1 << 4,
|
||||
vector_debug_has_owner_count_rolled_over = 1 << 5,
|
||||
vector_debug_has_been_resized = 1 << 6,
|
||||
vector_debug_has_been_resized_rolled_over = 1 << 7
|
||||
}
|
||||
vector_flag_enum;
|
||||
|
||||
typedef enum
|
||||
vector_growth_rate_enum
|
||||
{
|
||||
vector_growth_none = 0,
|
||||
vector_growth_linear = 1,
|
||||
vector_growth_double = 2,
|
||||
vector_growth_triple = 3,
|
||||
vector_growth_quadruple = 4,
|
||||
vector_growth_quintuple = 5
|
||||
}
|
||||
vector_growth_rate_enum;
|
||||
|
||||
typedef struct
|
||||
vector_struct
|
||||
{
|
||||
size_t item_size;
|
||||
size_t current_capacity;
|
||||
size_t current_occupancy;
|
||||
void* data_pointer;
|
||||
int (*comparator)(const void *, const void *);
|
||||
void (*item_free)(const void *);
|
||||
pthread_mutex_t* mutex_lock;
|
||||
unsigned short owner_count;
|
||||
uint8_t growth_strategy;
|
||||
uint8_t flags;
|
||||
#ifdef MARIGOLD_DEBUG
|
||||
uint8_t debug_flags;
|
||||
uint32_t debug_resize_count;
|
||||
uint32_t debug_function_call_count;
|
||||
uint32_t debug_last_error_code;
|
||||
uint32_t debug_allocation_failures;
|
||||
|
||||
#endif /* MARIGOLD_DEBUG. */
|
||||
}
|
||||
vector_struct;
|
||||
|
||||
vector_struct* vector_initialize();
|
||||
|
||||
void vector_free_members();
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "marigold_vector.h"
|
||||
#include "internal/internal_marigold_vector.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
@@ -1,60 +1,7 @@
|
||||
#ifndef MARIGOLD_VECTOR_H
|
||||
#define MARIGOLD_VECTOR_H
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef enum
|
||||
vector_flag_enum
|
||||
{
|
||||
vector_multithread_safe = 1 << 0,
|
||||
vector_read_only = 1 << 1,
|
||||
vector_certainly_sorted = 1 << 2,
|
||||
vector_marked_for_free = 1 << 3,
|
||||
vector_debug_has_function_call_rolled_over = 1 << 4,
|
||||
vector_debug_has_owner_count_rolled_over = 1 << 5,
|
||||
vector_debug_has_been_resized = 1 << 6,
|
||||
vector_debug_has_been_resized_rolled_over = 1 << 7
|
||||
}
|
||||
vector_flag_enum;
|
||||
|
||||
typedef enum
|
||||
vector_growth_rate_enum
|
||||
{
|
||||
vector_growth_none = 0,
|
||||
vector_growth_linear = 1,
|
||||
vector_growth_double = 2,
|
||||
vector_growth_triple = 3,
|
||||
vector_growth_quadruple = 4,
|
||||
vector_growth_quintuple = 5
|
||||
}
|
||||
vector_growth_rate_enum;
|
||||
|
||||
typedef struct
|
||||
vector_struct
|
||||
{
|
||||
size_t item_size;
|
||||
size_t current_capacity;
|
||||
size_t current_occupancy;
|
||||
void* data_pointer;
|
||||
int (*comparator)(const void *, const void *);
|
||||
void (*item_free)(const void *);
|
||||
pthread_mutex_t* mutex_lock;
|
||||
unsigned short owner_count;
|
||||
uint8_t growth_strategy;
|
||||
uint8_t flags;
|
||||
#ifdef MARIGOLD_DEBUG
|
||||
uint8_t debug_flags;
|
||||
uint32_t debug_resize_count;
|
||||
uint32_t debug_function_call_count;
|
||||
uint32_t debug_last_error_code;
|
||||
uint32_t debug_allocation_failures;
|
||||
|
||||
#endif /* MARIGOLD_DEBUG. */
|
||||
}
|
||||
vector_struct;
|
||||
#include "internal/internal_marigold_vector.h"
|
||||
|
||||
/**
|
||||
* @brief Create a new dynamic vector, it then internally does all the
|
||||
|
||||
Reference in New Issue
Block a user