Changes in uspace/lib/bithenge/src/tree.c [b7fd2a0:6cd10ac] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/bithenge/src/tree.c
rb7fd2a0 r6cd10ac 86 86 } get_for_each_data_t; 87 87 88 static errno_t get_for_each_func(bithenge_node_t *key, bithenge_node_t *value,88 static int get_for_each_func(bithenge_node_t *key, bithenge_node_t *value, 89 89 void *raw_data) 90 90 { 91 91 get_for_each_data_t *data = (get_for_each_data_t *)raw_data; 92 92 bool equal; 93 errno_t rc = bithenge_node_equal(&equal, key, data->key);93 int rc = bithenge_node_equal(&equal, key, data->key); 94 94 bithenge_node_dec_ref(key); 95 95 if (rc != EOK) … … 113 113 * @return EOK on success, ENOENT if not found, or another error code from 114 114 * errno.h. */ 115 errno_t bithenge_node_get(bithenge_node_t *self, bithenge_node_t *key,115 int bithenge_node_get(bithenge_node_t *self, bithenge_node_t *key, 116 116 bithenge_node_t **out) 117 117 { … … 125 125 uint8_t byte; 126 126 aoff64_t size = 1; 127 errno_t rc = bithenge_blob_read(bithenge_node_as_blob(self),127 int rc = bithenge_blob_read(bithenge_node_as_blob(self), 128 128 offset, (char *)&byte, &size); 129 129 if (rc != EOK) … … 140 140 *out = NULL; 141 141 get_for_each_data_t data = {key, out}; 142 errno_t rc = bithenge_node_for_each(self, get_for_each_func, &data);142 int rc = bithenge_node_for_each(self, get_for_each_func, &data); 143 143 bithenge_node_dec_ref(key); 144 144 if (rc == EEXIST && *out) … … 155 155 * @param[in] ops The operations provided. 156 156 * @return EOK on success or an error code from errno.h. */ 157 errno_t bithenge_init_internal_node(bithenge_node_t *self,157 int bithenge_init_internal_node(bithenge_node_t *self, 158 158 const bithenge_internal_node_ops_t *ops) 159 159 { … … 169 169 } 170 170 171 static errno_t empty_internal_node_for_each(bithenge_node_t *base,171 static int empty_internal_node_for_each(bithenge_node_t *base, 172 172 bithenge_for_each_func_t func, void *data) 173 173 { … … 175 175 } 176 176 177 static errno_t empty_internal_node_get(bithenge_node_t *self, bithenge_node_t *key,177 static int empty_internal_node_get(bithenge_node_t *self, bithenge_node_t *key, 178 178 bithenge_node_t **out) 179 179 { … … 196 196 * @param[out] out Holds the created node. 197 197 * @return EOK on success or an error code from errno.h. */ 198 errno_t bithenge_new_empty_internal_node(bithenge_node_t **out)198 int bithenge_new_empty_internal_node(bithenge_node_t **out) 199 199 { 200 200 if (bithenge_should_fail()) … … 223 223 } 224 224 225 static errno_t simple_internal_node_for_each(bithenge_node_t *base,225 static int simple_internal_node_for_each(bithenge_node_t *base, 226 226 bithenge_for_each_func_t func, void *data) 227 227 { 228 errno_t rc;228 int rc; 229 229 simple_internal_node_t *self = node_as_simple(base); 230 230 for (bithenge_int_t i = 0; i < self->len; i++) { … … 264 264 * the nodes array rather than just dereferencing each node inside it. 265 265 * @return EOK on success or an error code from errno.h. */ 266 errno_t bithenge_new_simple_internal_node(bithenge_node_t **out,266 int bithenge_new_simple_internal_node(bithenge_node_t **out, 267 267 bithenge_node_t **nodes, bithenge_int_t len, bool needs_free) 268 268 { 269 errno_t rc;269 int rc; 270 270 assert(out); 271 271 simple_internal_node_t *self = malloc(sizeof(*self)); … … 300 300 * @param value The value for the node to hold. 301 301 * @return EOK on success or an error code from errno.h. */ 302 errno_t bithenge_new_boolean_node(bithenge_node_t **out, bool value)302 int bithenge_new_boolean_node(bithenge_node_t **out, bool value) 303 303 { 304 304 assert(out); … … 315 315 * @param value The value for the node to hold. 316 316 * @return EOK on success or an error code from errno.h. */ 317 errno_t bithenge_new_integer_node(bithenge_node_t **out, bithenge_int_t value)317 int bithenge_new_integer_node(bithenge_node_t **out, bithenge_int_t value) 318 318 { 319 319 assert(out); … … 335 335 * destroyed. 336 336 * @return EOK on success or an error code from errno.h. */ 337 errno_t bithenge_new_string_node(bithenge_node_t **out, const char *value, bool needs_free)337 int bithenge_new_string_node(bithenge_node_t **out, const char *value, bool needs_free) 338 338 { 339 339 assert(out); … … 359 359 * @return EOK on success or an error code from errno.h. 360 360 * @todo Add support for internal nodes. */ 361 errno_t bithenge_node_equal(bool *out, bithenge_node_t *a, bithenge_node_t *b)361 int bithenge_node_equal(bool *out, bithenge_node_t *a, bithenge_node_t *b) 362 362 { 363 363 if (a->type != b->type) {
Note:
See TracChangeset
for help on using the changeset viewer.