Changeset 0191bd3 in mainline for uspace/app/bithenge/sequence.c
- Timestamp:
- 2012-08-07T04:30:04Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a8be91a
- Parents:
- f9c314a5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/sequence.c
rf9c314a5 r0191bd3 267 267 self->num_ends = 0; 268 268 self->end_on_empty = end_on_empty; 269 int rc = bithenge_scope_new(&self->scope); 270 if (rc != EOK) { 271 free(self->ends); 272 return rc; 273 } 274 rc = bithenge_scope_copy(self->scope, scope); 275 if (rc != EOK) { 276 bithenge_scope_dec_ref(self->scope); 277 free(self->ends); 278 return rc; 279 } 269 self->scope = scope; 270 if (self->scope) 271 bithenge_scope_inc_ref(self->scope); 280 272 return EOK; 281 273 } … … 468 460 return rc; 469 461 } 470 471 rc = seq_node_init(struct_as_seq(node), &struct_node_seq_ops, scope, 462 bithenge_scope_t *inner; 463 rc = bithenge_scope_new(&inner, scope); 464 if (rc != EOK) { 465 free(node); 466 return rc; 467 } 468 /* We should inc_ref(node) here, but that would make a cycle. Instead, 469 * we leave it 1 too low, so that when the only remaining use of node 470 * is the scope, node will be destroyed. Also see the comment in 471 * struct_node_destroy. */ 472 bithenge_scope_set_current_node(inner, struct_as_node(node)); 473 474 rc = seq_node_init(struct_as_seq(node), &struct_node_seq_ops, inner, 472 475 blob, self->num_subtransforms, false); 476 bithenge_scope_dec_ref(inner); 473 477 if (rc != EOK) { 474 478 free(node); … … 480 484 node->prefix = prefix; 481 485 *out = struct_as_node(node); 482 483 /* We should inc_ref(*out) here, but that would make a cycle. Instead,484 * we leave it 1 too low, so that when the only remaining use of *out485 * is the scope, *out will be destroyed. Also see the comment in486 * struct_node_destroy. */487 bithenge_scope_set_current_node(seq_node_scope(struct_as_seq(node)),488 *out);489 486 490 487 return EOK; … … 942 939 943 940 bithenge_scope_t *scope; 944 rc = bithenge_scope_new(&scope); 941 rc = bithenge_scope_new(&scope, 942 seq_node_scope(do_while_as_seq(self))); 945 943 if (rc != EOK) { 946 944 bithenge_node_dec_ref(subxform_result); 947 945 return rc; 948 946 } 949 rc = bithenge_scope_copy(scope,950 seq_node_scope(do_while_as_seq(self)));951 947 bithenge_scope_set_current_node(scope, subxform_result); 952 if (rc != EOK) {953 bithenge_scope_dec_ref(scope);954 return rc;955 }956 948 bithenge_node_t *expr_result; 957 949 rc = bithenge_expression_evaluate(self->expr, scope,
Note:
See TracChangeset
for help on using the changeset viewer.