Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 10334c2e in mainline for uspace/app/bithenge/tree.c


Ignore:
Timestamp:
2012-07-30T01:40:55Z (9 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master
Children:
20ac1a4
Parents:
d1e580a
Message:

Bithenge: add if_transform

File:
1 edited

Legend:

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

    rd1e580a r10334c2e  
    126126}
    127127
     128/** Initialize an internal node.
     129 * @memberof bithenge_node_t
     130 * @param[out] self The node.
     131 * @param[in] ops The operations provided.
     132 * @return EOK on success or an error code from errno.h. */
     133int bithenge_init_internal_node(bithenge_node_t *self,
     134    const bithenge_internal_node_ops_t *ops)
     135{
     136        self->type = BITHENGE_NODE_INTERNAL;
     137        self->refs = 1;
     138        self->internal_ops = ops;
     139        return EOK;
     140}
     141
     142static void internal_node_indestructible(bithenge_node_t *self)
     143{
     144        assert(false);
     145}
     146
     147static int empty_internal_node_for_each(bithenge_node_t *base,
     148    bithenge_for_each_func_t func, void *data)
     149{
     150        return EOK;
     151}
     152
     153static int empty_internal_node_get(bithenge_node_t *self, bithenge_node_t *key,
     154    bithenge_node_t **out)
     155{
     156        return ENOENT;
     157}
     158
     159static const bithenge_internal_node_ops_t empty_internal_node_ops = {
     160        .for_each = empty_internal_node_for_each,
     161        .get = empty_internal_node_get,
     162        .destroy = internal_node_indestructible,
     163};
     164
     165static bithenge_node_t empty_internal_node = {
     166        BITHENGE_NODE_INTERNAL,
     167        1,
     168        { .internal_ops = &empty_internal_node_ops },
     169};
     170
     171/** Create an empty internal node.
     172 * @param[out] out Holds the created node.
     173 * @return EOK on success or an error code from errno.h. */
     174int bithenge_new_empty_internal_node(bithenge_node_t **out)
     175{
     176        bithenge_node_inc_ref(&empty_internal_node);
     177        *out = &empty_internal_node;
     178        return EOK;
     179}
     180
    128181typedef struct
    129182{
     
    173226        .destroy = simple_internal_node_destroy,
    174227};
    175 
    176 /** Initialize an internal node.
    177  * @memberof bithenge_node_t
    178  * @param[out] self The node.
    179  * @param[in] ops The operations provided.
    180  * @return EOK on success or an error code from errno.h. */
    181 int bithenge_init_internal_node(bithenge_node_t *self,
    182     const bithenge_internal_node_ops_t *ops)
    183 {
    184         self->type = BITHENGE_NODE_INTERNAL;
    185         self->refs = 1;
    186         self->internal_ops = ops;
    187         return EOK;
    188 }
    189228
    190229/** Create an internal node from a set of keys and values. This function takes
Note: See TracChangeset for help on using the changeset viewer.