Changeset d5070ef in mainline for uspace/app/bithenge/tree.c


Ignore:
Timestamp:
2012-06-22T05:32:30Z (13 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
da0fef6
Parents:
8b36bf2
Message:

Bithenge: transforms and uint32le_transform

File:
1 edited

Legend:

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

    r8b36bf2 rd5070ef  
    3737#include <errno.h>
    3838#include <stdlib.h>
     39#include <str.h>
    3940#include "blob.h"
    4041#include "tree.h"
     
    207208}
    208209
     210/** Check whether the contents of two nodes are equal. Does not yet work for
     211 * internal nodes.
     212 * @memberof bithenge_node_t
     213 * @param a, b Nodes to compare.
     214 * @return Whether the nodes are equal. If an error occurs, returns false.
     215 * @todo Add support for internal nodes.
     216 */
     217bool bithenge_node_equal(bithenge_node_t *a, bithenge_node_t *b)
     218{
     219        if (a->type != b->type)
     220                return false;
     221        switch (a->type) {
     222        case BITHENGE_NODE_INTERNAL:
     223                return false;
     224        case BITHENGE_NODE_BOOLEAN:
     225                return a->boolean_value == b->boolean_value;
     226        case BITHENGE_NODE_INTEGER:
     227                return a->integer_value == b->integer_value;
     228        case BITHENGE_NODE_STRING:
     229                return !str_cmp(a->string_value.ptr, b->string_value.ptr);
     230        case BITHENGE_NODE_BLOB:
     231                return bithenge_blob_equal(bithenge_node_as_blob(a),
     232                    bithenge_node_as_blob(b));
     233        }
     234        return false;
     235}
     236
    209237/** @}
    210238 */
Note: See TracChangeset for help on using the changeset viewer.