Changeset 978ccaf1 in mainline for uspace/app/bithenge/tree.h


Ignore:
Timestamp:
2012-06-27T03:35:43Z (12 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
600f5d1
Parents:
04a7435f
Message:

Bithenge: various cleanup and tweaks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bithenge/tree.h

    r04a7435f r978ccaf1  
    9393typedef struct bithenge_internal_node_ops_t {
    9494        /** @copydoc bithenge_node_t::bithenge_node_for_each */
    95         int (*for_each)(bithenge_node_t *node, bithenge_for_each_func_t func, void *data);
    96         /** @copydoc bithenge_node_t::bithenge_node_destroy */
    97         int (*destroy)(bithenge_node_t *node);
     95        int (*for_each)(bithenge_node_t *self, bithenge_for_each_func_t func, void *data);
     96        /** Destroys the internal node.
     97         * @param self The node to destroy. */
     98        void (*destroy)(bithenge_node_t *self);
    9899} bithenge_internal_node_ops_t;
    99100
     
    109110/** Increment a node's reference count.
    110111 * @memberof bithenge_node_t
    111  * @param node The node to reference.
    112  * @return EOK on success or an error code from errno.h. */
    113 static inline int bithenge_node_inc_ref(bithenge_node_t *node)
     112 * @param node The node to reference. */
     113static inline void bithenge_node_inc_ref(bithenge_node_t *node)
    114114{
    115115        assert(node);
    116116        node->refs++;
    117         return EOK;
    118117}
    119118
    120 int bithenge_node_dec_ref(bithenge_node_t *node);
     119void bithenge_node_dec_ref(bithenge_node_t *node);
    121120
    122121/** Iterate over a node's children.
    123122 * @memberof bithenge_node_t
    124  * @param node The internal node to iterate over.
     123 * @param self The internal node to iterate over.
    125124 * @param func The callback function.
    126125 * @param data Data to provide to the callback function.
    127126 * @return EOK on success or an error code from errno.h. */
    128 static inline int bithenge_node_for_each(bithenge_node_t *node, bithenge_for_each_func_t func, void *data)
     127static inline int bithenge_node_for_each(bithenge_node_t *self,
     128    bithenge_for_each_func_t func, void *data)
    129129{
    130         assert(node->type == BITHENGE_NODE_INTERNAL);
    131         return node->internal_ops->for_each(node, func, data);
     130        assert(self->type == BITHENGE_NODE_INTERNAL);
     131        return self->internal_ops->for_each(self, func, data);
    132132}
    133133
    134134/** Get the value of a boolean node.
    135135 * @memberof bithenge_node_t
    136  * @param node The boolean node.
     136 * @param self The boolean node.
    137137 * @return The node's value. */
    138 static inline bool bithenge_boolean_node_value(bithenge_node_t *node)
     138static inline bool bithenge_boolean_node_value(bithenge_node_t *self)
    139139{
    140         assert(node->type == BITHENGE_NODE_BOOLEAN);
    141         return node->boolean_value;
     140        assert(self->type == BITHENGE_NODE_BOOLEAN);
     141        return self->boolean_value;
    142142}
    143143
    144144/** Get the value of an integer node.
    145145 * @memberof bithenge_node_t
    146  * @param node The integer node.
     146 * @param self The integer node.
    147147 * @return The node's value. */
    148 static inline bithenge_int_t bithenge_integer_node_value(bithenge_node_t *node)
     148static inline bithenge_int_t bithenge_integer_node_value(bithenge_node_t *self)
    149149{
    150         assert(node->type == BITHENGE_NODE_INTEGER);
    151         return node->integer_value;
     150        assert(self->type == BITHENGE_NODE_INTEGER);
     151        return self->integer_value;
    152152}
    153153
    154154/** Get the value of an string node.
    155155 * @memberof bithenge_node_t
    156  * @param node The string node.
     156 * @param self The string node.
    157157 * @return The node's value. */
    158 static inline const char *bithenge_string_node_value(bithenge_node_t *node)
     158static inline const char *bithenge_string_node_value(bithenge_node_t *self)
    159159{
    160         assert(node->type == BITHENGE_NODE_STRING);
    161         return node->string_value.ptr;
     160        assert(self->type == BITHENGE_NODE_STRING);
     161        return self->string_value.ptr;
    162162}
    163163
Note: See TracChangeset for help on using the changeset viewer.