@@ -44,7 +44,9 @@ struct node {
4444 *
4545 * @param data_size the size of each element in the deque; must be positive
4646 *
47- * @return the newly-initialized deque, or NULL if memory allocation error
47+ * @return the newly-initialized deque, or NULL if it was not successfully
48+ * initialized due to either invalid input arguments or memory
49+ * allocation error
4850 */
4951deque deque_init (const size_t data_size )
5052{
@@ -145,7 +147,10 @@ int deque_trim(deque me)
145147}
146148
147149/**
148- * Copies the deque to an array.
150+ * Copies the deque to an array. Since it is a copy, the array may be modified
151+ * without causing side effects to the deque data structure. Memory is not
152+ * allocated, thus the array being used for the copy must be allocated before
153+ * this function is called.
149154 *
150155 * @param arr the initialized array to copy the deque to
151156 * @param me the deque to copy to the array
@@ -159,7 +164,11 @@ void deque_copy_to_array(void *const arr, deque me)
159164}
160165
161166/**
162- * Adds an element to the front of the deque.
167+ * Adds an element to the front of the deque. The pointer to the data being
168+ * passed in should point to the data type which this deque holds. For example,
169+ * if this deque holds integers, the data pointer should be a pointer to an
170+ * integer. Since the data is being copied, the pointer only has to be valid
171+ * when this function is called.
163172 *
164173 * @param me the deque to add an element to
165174 * @param data the element to add
@@ -221,7 +230,11 @@ int deque_push_front(deque me, void *const data)
221230}
222231
223232/**
224- * Adds an element to the back of the deque.
233+ * Adds an element to the back of the deque. The pointer to the data being
234+ * passed in should point to the data type which this deque holds. For example,
235+ * if this deque holds integers, the data pointer should be a pointer to an
236+ * integer. Since the data is being copied, the pointer only has to be valid
237+ * when this function is called.
225238 *
226239 * @param me the deque to add an element to
227240 * @param data the element to add
@@ -268,7 +281,12 @@ int deque_push_back(deque me, void *const data)
268281}
269282
270283/**
271- * Removes the front element from the deque and copies it to a data value.
284+ * Removes the front element from the deque and copies it to a data value. The
285+ * pointer to the data being obtained should point to the data type which this
286+ * deque holds. For example, if this deque holds integers, the data pointer
287+ * should be a pointer to an integer. Since this data is being copied from the
288+ * array to the data pointer, the pointer only has to be valid when this
289+ * function is called.
272290 *
273291 * @param data the value to copy to
274292 * @param me the deque to remove from
@@ -294,7 +312,12 @@ int deque_pop_front(void *const data, deque me)
294312}
295313
296314/**
297- * Removes the back element from the deque and copies it to a data value.
315+ * Removes the back element from the deque and copies it to a data value. The
316+ * pointer to the data being obtained should point to the data type which this
317+ * deque holds. For example, if this deque holds integers, the data pointer
318+ * should be a pointer to an integer. Since this data is being copied from the
319+ * array to the data pointer, the pointer only has to be valid when this
320+ * function is called.
298321 *
299322 * @param data the value to copy to
300323 * @param me the deque to remove from
@@ -320,7 +343,11 @@ int deque_pop_back(void *const data, deque me)
320343}
321344
322345/**
323- * Sets the first value of the deque.
346+ * Sets the first value of the deque. The pointer to the data being passed in
347+ * should point to the data type which this deque holds. For example, if this
348+ * deque holds integers, the data pointer should be a pointer to an integer.
349+ * Since the data is being copied, the pointer only has to be valid when this
350+ * function is called.
324351 *
325352 * @param me the deque to set value of
326353 * @param data the data to set
@@ -334,7 +361,11 @@ int deque_set_first(deque me, void *const data)
334361}
335362
336363/**
337- * Sets the value of the deque at the specified index.
364+ * Sets the value of the deque at the specified index. The pointer to the data
365+ * being passed in should point to the data type which this deque holds. For
366+ * example, if this deque holds integers, the data pointer should be a pointer
367+ * to an integer. Since the data is being copied, the pointer only has to be
368+ * valid when this function is called.
338369 *
339370 * @param me the deque to set value of
340371 * @param index the index to set at
@@ -361,7 +392,11 @@ int deque_set_at(deque me, int index, void *const data)
361392}
362393
363394/**
364- * Sets the last value of the deque.
395+ * Sets the last value of the deque. The pointer to the data being passed in
396+ * should point to the data type which this deque holds. For example, if this
397+ * deque holds integers, the data pointer should be a pointer to an integer.
398+ * Since the data is being copied, the pointer only has to be valid when this
399+ * function is called.
365400 *
366401 * @param me the deque to set value of
367402 * @param data the data to set
@@ -375,7 +410,11 @@ int deque_set_last(deque me, void *const data)
375410}
376411
377412/**
378- * Gets the first value of the deque.
413+ * Gets the first value of the deque. The pointer to the data being obtained
414+ * should point to the data type which this deque holds. For example, if this
415+ * deque holds integers, the data pointer should be a pointer to an integer.
416+ * Since this data is being copied from the array to the data pointer, the
417+ * pointer only has to be valid when this function is called.
379418 *
380419 * @param data the data to set
381420 * @param me the deque to set value of
@@ -389,7 +428,11 @@ int deque_get_first(void *const data, deque me)
389428}
390429
391430/**
392- * Gets the value of the deque at the specified index.
431+ * Gets the value of the deque at the specified index. The pointer to the data
432+ * being obtained should point to the data type which this deque holds. For
433+ * example, if this deque holds integers, the data pointer should be a pointer
434+ * to an integer. Since this data is being copied from the array to the data
435+ * pointer, the pointer only has to be valid when this function is called.
393436 *
394437 * @param data the data to set
395438 * @param me the deque to set value of
@@ -416,7 +459,11 @@ int deque_get_at(void *const data, deque me, int index)
416459}
417460
418461/**
419- * Gets the last value of the deque.
462+ * Gets the last value of the deque. The pointer to the data being obtained
463+ * should point to the data type which this deque holds. For example, if this
464+ * deque holds integers, the data pointer should be a pointer to an integer.
465+ * Since this data is being copied from the array to the data pointer, the
466+ * pointer only has to be valid when this function is called.
420467 *
421468 * @param data the data to set
422469 * @param me the deque to set value of
0 commit comments