| 370 | } |
| 371 | |
| 372 | static errno_t struct_node_get(bithenge_node_t *base, bithenge_node_t *key, |
| 373 | bithenge_node_t **out) |
| 374 | { |
| 375 | struct_node_t *self = node_as_struct(base); |
| 376 | |
| 377 | errno_t rc = ENOENT; |
| 378 | if (bithenge_node_type(key) != BITHENGE_NODE_STRING) |
| 379 | goto end; |
| 380 | const char *name = bithenge_string_node_value(key); |
| 381 | |
| 382 | const bithenge_named_transform_t *subxforms = |
| 383 | self->transform->subtransforms; |
| 384 | for (bithenge_int_t i = 0; subxforms[i].transform; i++) { |
| 385 | if (subxforms[i].name && !str_cmp(name, subxforms[i].name)) { |
| 386 | rc = seq_node_subtransform(struct_as_seq(self), out, i); |
| 387 | goto end; |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | for (bithenge_int_t i = 0; subxforms[i].transform; i++) { |
| 392 | if (subxforms[i].name) |
| 393 | continue; |
| 394 | bithenge_node_t *subxform_result; |
| 395 | rc = seq_node_subtransform(struct_as_seq(self), |
| 396 | &subxform_result, i); |
| 397 | if (rc != EOK) |
| 398 | goto end; |
| 399 | if (bithenge_node_type(subxform_result) != |
| 400 | BITHENGE_NODE_INTERNAL) { |
| 401 | bithenge_node_dec_ref(subxform_result); |
| 402 | rc = EINVAL; |
| 403 | goto end; |
| 404 | } |
| 405 | bithenge_node_inc_ref(key); |
| 406 | rc = bithenge_node_get(subxform_result, key, out); |
| 407 | bithenge_node_dec_ref(subxform_result); |
| 408 | if (rc != ENOENT) |
| 409 | goto end; |
| 410 | } |
| 411 | |
| 412 | rc = ENOENT; |
| 413 | end: |
| 414 | bithenge_node_dec_ref(key); |
| 415 | return rc; |
| 416 | } |
| 417 | |
| 418 | static void struct_node_destroy(bithenge_node_t *base) |
| 419 | { |
nothing calls this directly
no test coverage detected