@@ -33,18 +33,17 @@ struct aws_array_list {
33
33
* return a positive number if a > b, zero if a = b, and a negative number
34
34
* if a < b.
35
35
*/
36
- typedef int ( * aws_array_list_comparator )(const void * a , const void * b );
36
+ typedef int ( aws_array_list_comparator_fn )(const void * a , const void * b );
37
37
38
38
#ifdef __cplusplus
39
39
extern "C" {
40
40
#endif
41
41
42
42
/**
43
- * Initializes an array list with an array of size initial_item_allocation *
44
- * item_size. In this mode, the array size will grow by a factor of 2 upon
45
- * insertion if space is not available. initial_item_allocation is the number of
46
- * elements you want space allocated for. item_size is the size of each element
47
- * in bytes. Mixing items types is not supported by this API.
43
+ * Initializes an array list with an array of size initial_item_allocation * item_size. In this mode, the array size
44
+ * will grow by a factor of 2 upon insertion if space is not available. initial_item_allocation is the number of
45
+ * elements you want space allocated for. item_size is the size of each element in bytes. Mixing items types is not
46
+ * supported by this API.
48
47
*/
49
48
AWS_COMMON_API
50
49
int aws_array_list_init_dynamic (
@@ -54,17 +53,15 @@ int aws_array_list_init_dynamic(
54
53
size_t item_size );
55
54
56
55
/**
57
- * Initializes an array list with a preallocated array of void *. item_count is
58
- * the number of elements in the array, and item_size is the size in bytes of
59
- * each element. Mixing items types is not supported by this API. Once this list
60
- * is full, new items will be rejected.
56
+ * Initializes an array list with a preallocated array of void *. item_count is the number of elements in the array,
57
+ * and item_size is the size in bytes of each element. Mixing items types is not supported
58
+ * by this API. Once this list is full, new items will be rejected.
61
59
*/
62
60
AWS_COMMON_API
63
61
void aws_array_list_init_static (struct aws_array_list * list , void * raw_array , size_t item_count , size_t item_size );
64
62
65
63
/**
66
- * Deallocates any memory that was allocated for this list, and resets list for
67
- * reuse or deletion.
64
+ * Deallocates any memory that was allocated for this list, and resets list for reuse or deletion.
68
65
*/
69
66
AWS_COMMON_API
70
67
void aws_array_list_clean_up (struct aws_array_list * list );
@@ -76,17 +73,15 @@ AWS_COMMON_API
76
73
int aws_array_list_push_back (struct aws_array_list * list , const void * val );
77
74
78
75
/**
79
- * Copies the element at the front of the list if it exists. If list is empty,
80
- * AWS_ERROR_LIST_EMPTY will be raised
76
+ * Copies the element at the front of the list if it exists. If list is empty, AWS_ERROR_LIST_EMPTY will be raised
81
77
*/
82
78
AWS_COMMON_API
83
79
int aws_array_list_front (const struct aws_array_list * list , void * val );
84
80
85
81
/**
86
- * Deletes the element at the front of the list if it exists. If list is empty,
87
- * AWS_ERROR_LIST_EMPTY will be raised. This call results in shifting all of the
88
- * elements at the end of the array to the front. Avoid this call unless that is
89
- * intended behavior.
82
+ * Deletes the element at the front of the list if it exists. If list is empty, AWS_ERROR_LIST_EMPTY will be raised.
83
+ * This call results in shifting all of the elements at the end of the array to the front. Avoid this call unless that
84
+ * is intended behavior.
90
85
*/
91
86
AWS_COMMON_API
92
87
int aws_array_list_pop_front (struct aws_array_list * list );
@@ -101,51 +96,45 @@ AWS_COMMON_API
101
96
void aws_array_list_pop_front_n (struct aws_array_list * list , size_t n );
102
97
103
98
/**
104
- * Copies the element at the end of the list if it exists. If list is empty,
105
- * AWS_ERROR_LIST_EMPTY will be raised.
99
+ * Copies the element at the end of the list if it exists. If list is empty, AWS_ERROR_LIST_EMPTY will be raised.
106
100
*/
107
101
AWS_COMMON_API
108
102
int aws_array_list_back (const struct aws_array_list * list , void * val );
109
103
110
104
/**
111
- * Deletes the element at the end of the list if it exists. If list is empty,
112
- * AWS_ERROR_LIST_EMPTY will be raised.
105
+ * Deletes the element at the end of the list if it exists. If list is empty, AWS_ERROR_LIST_EMPTY will be raised.
113
106
*/
114
107
AWS_COMMON_API
115
108
int aws_array_list_pop_back (struct aws_array_list * list );
116
109
117
110
/**
118
- * Clears all elements in the array and resets length to zero. Size does not
119
- * change in this operation.
111
+ * Clears all elements in the array and resets length to zero. Size does not change in this operation.
120
112
*/
121
113
AWS_COMMON_API
122
114
void aws_array_list_clear (struct aws_array_list * list );
123
115
124
116
/**
125
- * If in dynamic mode, shrinks the allocated array size to the minimum amount
126
- * necessary to store its elements.
117
+ * If in dynamic mode, shrinks the allocated array size to the minimum amount necessary to store its elements.
127
118
*/
128
119
AWS_COMMON_API
129
120
int aws_array_list_shrink_to_fit (struct aws_array_list * list );
130
121
131
122
/**
132
- * Copies the elements from from to to. If to is in static mode, it must at
133
- * least be the same length as from. Any data in to will be overwritten in this
134
- * copy.
123
+ * Copies the elements from from to to. If to is in static mode, it must at least be the same length as from. Any data
124
+ * in to will be overwritten in this copy.
135
125
*/
136
126
AWS_COMMON_API
137
127
int aws_array_list_copy (const struct aws_array_list * from , struct aws_array_list * to );
138
128
139
129
/**
140
- * Swap contents between two dynamic lists. Both lists must use the same
141
- * allocator.
130
+ * Swap contents between two dynamic lists. Both lists must use the same allocator.
142
131
*/
143
132
AWS_COMMON_API
144
133
void aws_array_list_swap_contents (struct aws_array_list * list_a , struct aws_array_list * list_b );
145
134
146
135
/**
147
- * Returns the number of elements that can fit in the internal array. If list is
148
- * initialized in dynamic mode, the capacity changes over time.
136
+ * Returns the number of elements that can fit in the internal array. If list is initialized in dynamic mode,
137
+ * the capacity changes over time.
149
138
*/
150
139
AWS_COMMON_API
151
140
size_t aws_array_list_capacity (const struct aws_array_list * list );
@@ -157,24 +146,22 @@ AWS_COMMON_API
157
146
size_t aws_array_list_length (const struct aws_array_list * list );
158
147
159
148
/**
160
- * Copies the memory at index to val. If element does not exist,
161
- * AWS_ERROR_INVALID_INDEX will be raised.
149
+ * Copies the memory at index to val. If element does not exist, AWS_ERROR_INVALID_INDEX will be raised.
162
150
*/
163
151
AWS_COMMON_API
164
152
int aws_array_list_get_at (const struct aws_array_list * list , void * val , size_t index );
165
153
166
154
/**
167
- * Copies the memory address of the element at index to *val. If element does
168
- * not exist, AWS_ERROR_INVALID_INDEX will be raised.
155
+ * Copies the memory address of the element at index to *val. If element does not exist, AWS_ERROR_INVALID_INDEX will be
156
+ * raised.
169
157
*/
170
158
AWS_COMMON_API
171
159
int aws_array_list_get_at_ptr (const struct aws_array_list * list , void * * val , size_t index );
172
160
173
161
/**
174
- * Copies the the memory pointed to by val into the array at index. If in
175
- * dynamic mode, the size will grow by a factor of two when the array is full.
176
- * In static mode, AWS_ERROR_INVALID_INDEX will be raised if the index is past
177
- * the bounds of the array.
162
+ * Copies the the memory pointed to by val into the array at index. If in dynamic mode, the size will grow by a factor
163
+ * of two when the array is full. In static mode, AWS_ERROR_INVALID_INDEX will be raised if the index is past the bounds
164
+ * of the array.
178
165
*/
179
166
AWS_COMMON_API
180
167
int aws_array_list_set_at (struct aws_array_list * list , const void * val , size_t index );
@@ -189,10 +176,10 @@ void aws_array_list_swap(struct aws_array_list *list, size_t a, size_t b);
189
176
* Sort elements in the list in-place according to the comparator function.
190
177
*/
191
178
AWS_COMMON_API
192
- void aws_array_list_sort (struct aws_array_list * list , aws_array_list_comparator compare_fn );
179
+ void aws_array_list_sort (struct aws_array_list * list , aws_array_list_comparator_fn * compare_fn );
193
180
194
181
#ifdef __cplusplus
195
182
}
196
183
#endif
197
184
198
- #endif /* AWS_COMMON_ARRAY_LIST_H */
185
+ #endif /*AWS_COMMON_ARRAY_LIST_H */
0 commit comments