Changeset 8375d0eb in mainline for uspace/app/bithenge/tree.c
- Timestamp:
- 2012-06-08T07:02:55Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8b36bf2
- Parents:
- 5c925ce
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/tree.c
r5c925ce r8375d0eb 47 47 } 48 48 49 /** Destroy a node. 50 * @memberof bithenge_node_t 51 * @param node The node to destroy. 52 * @return EOK on success or an error code from errno.h. */ 49 53 int bithenge_node_destroy(bithenge_node_t *node) 50 54 { … … 61 65 return EOK; // the boolean nodes are allocated statically below 62 66 case BITHENGE_NODE_INTEGER: /* pass-through */ 63 case BITHENGE_NODE_NONE:64 67 break; 65 68 } … … 81 84 } 82 85 83 static int simple_internal_node_for_each(bithenge_node_t *base, bithenge_for_each_func_t func, void *data) 86 static int simple_internal_node_for_each(bithenge_node_t *base, 87 bithenge_for_each_func_t func, void *data) 84 88 { 85 89 int rc; … … 121 125 } 122 126 123 int bithenge_new_simple_internal_node(bithenge_node_t **out, bithenge_node_t **nodes, bithenge_int_t len, bool needs_free) 127 /** Create an internal node from a set of keys and values. The node must be 128 * freed with @a bithenge_node_t::bithenge_node_destroy after it is used, which 129 * will also destroy all the key and value nodes. 130 * @memberof bithenge_node_t 131 * @param[out] out Stores the created internal node. 132 * @param nodes The array of key-value pairs. Keys are stored at even indices 133 * and values are stored at odd indices. 134 * @param len The number of key-value pairs in the node array. 135 * @param needs_free If true, when the internal node is destroyed it will free 136 * the nodes array as well as destroying each node inside it. 137 * @return EOK on success or an error code from errno.h. */ 138 int bithenge_new_simple_internal_node(bithenge_node_t **out, 139 bithenge_node_t **nodes, bithenge_int_t len, bool needs_free) 124 140 { 125 141 assert(out); … … 139 155 static bithenge_node_t true_node = { BITHENGE_NODE_BOOLEAN, .boolean_value = true }; 140 156 157 /** Create a boolean node. The node must be freed with @a 158 * bithenge_node_t::bithenge_node_destroy after it is used. 159 * @memberof bithenge_node_t 160 * @param[out] out Stores the created boolean node. 161 * @param value The value for the node to hold. 162 * @return EOK on success or an error code from errno.h. */ 141 163 int bithenge_new_boolean_node(bithenge_node_t **out, bool value) 142 164 { … … 146 168 } 147 169 170 /** Create an integer node. The node must be freed with @a 171 * bithenge_node_t::bithenge_node_destroy after it is used. 172 * @memberof bithenge_node_t 173 * @param[out] out Stores the created integer node. 174 * @param value The value for the node to hold. 175 * @return EOK on success or an error code from errno.h. */ 148 176 int bithenge_new_integer_node(bithenge_node_t **out, bithenge_int_t value) 149 177 { … … 158 186 } 159 187 188 /** Create a string node. The node must be freed with @a 189 * bithenge_node_t::bithenge_node_destroy after it is used. 190 * @memberof bithenge_node_t 191 * @param[out] out Stores the created string node. 192 * @param value The value for the node to hold. 193 * @param needs_free Whether the string should be freed when the node is 194 * destroyed. 195 * @return EOK on success or an error code from errno.h. */ 160 196 int bithenge_new_string_node(bithenge_node_t **out, const char *value, bool needs_free) 161 197 { … … 170 206 return EOK; 171 207 } 208 209 /** @} 210 */
Note:
See TracChangeset
for help on using the changeset viewer.