forked from toksaitov/au-array-fall-2018
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathau_array.c
85 lines (62 loc) · 1.36 KB
/
au_array.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <stdlib.h>
#include <assert.h>
#include "au_array.h"
#pragma mark - Creating Arrays
au_array* au_array_create()
{
return NULL;
}
au_array* au_array_create_of_length(size_t count, size_t size)
{
return NULL;
}
au_array* au_array_create_with_array(au_array *array)
{
return NULL;
}
au_array* au_array_create_with_buffer(void *buffer, size_t count, size_t size)
{
return NULL;
}
#pragma mark - Deallocating Arrays
void au_array_free(au_array *array)
{
}
void au_array_free_with_elements(au_array *array)
{
}
void au_array_free_with_element_handler(au_array *array, au_array_element_handler handler)
{
}
#pragma mark - Querying Metadata
bool au_array_is_empty(au_array *array)
{
return sizeof(array->elements) == 0;
}
size_t au_array_length(au_array *array)
{
return array->length;
}
size_t au_array_size(au_array *array)
{
return 0;
}
size_t au_array_element_size(au_array *array)
{
return 0;
}
#pragma mark - Querying an Array
void *au_array_first(au_array *array)
{
return NULL;
}
void *au_array_last(au_array *array)
{
if (array->elements == NULL) return NULL;
return array->elements + (array->length - 1) * array->element_size;
}
void *au_array_get(au_array *array, size_t index)
{
if (array->elements == NULL || index >= array->length) return NULL;
return array->elements + index * (array->element_size);
}