Ignore:
Timestamp:
2010-11-25T13:42:50Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8df8415
Parents:
a93d79a (diff), eb667613 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/adt/dynamic_fifo.c

    ra93d79a r8fb1bf82  
    2828
    2929/** @addtogroup libc
    30  *  @{
     30 * @{
    3131 */
    3232
     
    3434 * Dynamic first in first out positive integer queue implementation.
    3535 */
     36
     37#include <adt/dynamic_fifo.h>
    3638
    3739#include <errno.h>
     
    3941#include <mem.h>
    4042
    41 #include <adt/dynamic_fifo.h>
    42 
    4343/** Internal magic value for a consistency check. */
    4444#define DYN_FIFO_MAGIC_VALUE    0x58627659
     
    5656 *
    5757 * @param[in] fifo      The dynamic queue.
    58  * @returns             TRUE if the queue is valid.
    59  * @returns             FALSE otherwise.
    60  */
    61 static int dyn_fifo_is_valid(dyn_fifo_ref fifo)
     58 * @return              TRUE if the queue is valid.
     59 * @return              FALSE otherwise.
     60 */
     61static int dyn_fifo_is_valid(dyn_fifo_t *fifo)
    6262{
    6363        return fifo && (fifo->magic_value == DYN_FIFO_MAGIC_VALUE);
     
    6868 * @param[in,out] fifo  The dynamic queue.
    6969 * @param[in] size      The initial queue size.
    70  * @returns             EOK on success.
    71  * @returns             EINVAL if the queue is not valid.
    72  * @returns             EBADMEM if the fifo parameter is NULL.
    73  * @returns             ENOMEM if there is not enough memory left.
    74  */
    75 int dyn_fifo_initialize(dyn_fifo_ref fifo, int size)
     70 * @return              EOK on success.
     71 * @return              EINVAL if the queue is not valid.
     72 * @return              EBADMEM if the fifo parameter is NULL.
     73 * @return              ENOMEM if there is not enough memory left.
     74 */
     75int dyn_fifo_initialize(dyn_fifo_t *fifo, int size)
    7676{
    7777        if (!fifo)
     
    100100 *                      this limit. May be zero or negative to indicate no
    101101 *                      limit.
    102  * @returns             EOK on success.
    103  * @returns             EINVAL if the queue is not valid.
    104  * @returns             ENOMEM if there is not enough memory left.
    105  */
    106 int dyn_fifo_push(dyn_fifo_ref fifo, int value, int max_size)
    107 {
    108         int * new_items;
     102 * @return              EOK on success.
     103 * @return              EINVAL if the queue is not valid.
     104 * @return              ENOMEM if there is not enough memory left.
     105 */
     106int dyn_fifo_push(dyn_fifo_t *fifo, int value, int max_size)
     107{
     108        int *new_items;
    109109
    110110        if (!dyn_fifo_is_valid(fifo))
     
    149149/** Returns and excludes the first item in the queue.
    150150 *
    151  * @param[in,out] fifoi The dynamic queue.
    152  * @returns             Value of the first item in the queue.
    153  * @returns             EINVAL if the queue is not valid.
    154  * @returns             ENOENT if the queue is empty.
    155  */
    156 int dyn_fifo_pop(dyn_fifo_ref fifo)
     151 * @param[in,out] fifo  The dynamic queue.
     152 * @return              Value of the first item in the queue.
     153 * @return              EINVAL if the queue is not valid.
     154 * @return              ENOENT if the queue is empty.
     155 */
     156int dyn_fifo_pop(dyn_fifo_t *fifo)
    157157{
    158158        int value;
     
    172172 *
    173173 * @param[in,out] fifo  The dynamic queue.
    174  * @returnsi            Value of the first item in the queue.
    175  * @returns             EINVAL if the queue is not valid.
    176  * @returns             ENOENT if the queue is empty.
    177  */
    178 int dyn_fifo_value(dyn_fifo_ref fifo)
     174 * @return              Value of the first item in the queue.
     175 * @return              EINVAL if the queue is not valid.
     176 * @return              ENOENT if the queue is empty.
     177 */
     178int dyn_fifo_value(dyn_fifo_t *fifo)
    179179{
    180180        if (!dyn_fifo_is_valid(fifo))
     
    189189/** Clears and destroys the queue.
    190190 *
    191  *  @param[in,out] fifo         The dynamic queue.
    192  *  @returns                    EOK on success.
    193  *  @returns                    EINVAL if the queue is not valid.
    194  */
    195 int dyn_fifo_destroy(dyn_fifo_ref fifo)
     191 * @param[in,out] fifo  The dynamic queue.
     192 * @return              EOK on success.
     193 * @return              EINVAL if the queue is not valid.
     194 */
     195int dyn_fifo_destroy(dyn_fifo_t *fifo)
    196196{
    197197        if (!dyn_fifo_is_valid(fifo))
Note: See TracChangeset for help on using the changeset viewer.