Better memory management of arrays and test sample generation
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
int check_sorted(lsort_array_i* array);
|
||||
int check_sorted(lsort_array* array);
|
||||
|
||||
#endif
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
int lsort_quicksort(lsort_array_i* array, int (*function_pointer)(int, int));
|
||||
int lsort_quicksort(lsort_array* array);
|
||||
|
||||
#endif
|
||||
@@ -3,6 +3,6 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
int lsort_radix(lsort_array_i* array, lsort_array_i* return_array);
|
||||
int lsort_radix(lsort_array* array, lsort_array* return_array);
|
||||
|
||||
#endif
|
||||
@@ -10,29 +10,34 @@ typedef struct {
|
||||
} lsort_string;
|
||||
|
||||
typedef struct {
|
||||
size_t count;
|
||||
size_t capacity;
|
||||
int* items;
|
||||
} lsort_array_i;
|
||||
|
||||
|
||||
lsort_array_i* lsort_array_i_create();
|
||||
void lsort_array_i_destroy(lsort_array_i* array);
|
||||
|
||||
void lsort_array_i_append(lsort_array_i* array, int number);
|
||||
int lsort_array_i_swap(lsort_array_i* array, int indexA, int indexB);
|
||||
|
||||
void lsort_array_i_print(lsort_array_i* array);
|
||||
|
||||
int key;
|
||||
void* value;
|
||||
} lsort_item;
|
||||
|
||||
typedef struct {
|
||||
size_t count;
|
||||
size_t capacity;
|
||||
lsort_array_i** items;
|
||||
} lsort_array_i_array;
|
||||
lsort_item** items;
|
||||
} lsort_array;
|
||||
|
||||
void lsort_array_i_array_append(lsort_array_i_array* array, lsort_array_i* item);
|
||||
void lsort_array_i_array_destroy(lsort_array_i_array* array);
|
||||
typedef struct {
|
||||
size_t count;
|
||||
size_t capacity;
|
||||
lsort_array** items;
|
||||
} lsort_array_array;
|
||||
|
||||
lsort_item* lsort_item_create(int key, void* value);
|
||||
lsort_array* lsort_array_create();
|
||||
lsort_array_array* lsort_array_array_create();
|
||||
|
||||
void lsort_item_destroy(lsort_item* item);
|
||||
void lsort_array_destroy(lsort_array* array, int destroyItems);
|
||||
void lsort_array_array_destroy(lsort_array_array* array, int destroyItems);
|
||||
|
||||
void lsort_array_append(lsort_array* array, lsort_item* item);
|
||||
void lsort_array_array_append(lsort_array_array* array, lsort_array* item);
|
||||
|
||||
void lsort_array_clear(lsort_array* array);
|
||||
int lsort_array_swap(lsort_array* array, int indexA, int indexB);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user