diff options
author | Peter Johnson <peter@tortall.net> | 2010-08-18 06:23:06 +0000 |
---|---|---|
committer | Peter Johnson <peter@tortall.net> | 2010-08-18 06:23:06 +0000 |
commit | 7263e1d241bd776ecc270fcc0342863d3689c6f6 (patch) | |
tree | d6b504a4b00ad0fab1606f18462ac5da30268410 | |
parent | 50017b49af0b83359912bac0aa092a821e563b0a (diff) | |
download | yasm-7263e1d241bd776ecc270fcc0342863d3689c6f6.tar.gz |
Implement yasm_value_finalize_expr() using yasm_value_finalize().
Previously this was implemented the opposite way, contrary to its
documentation. This resulted in clearing any already set yasm_value
relative fields.
svn path=/trunk/yasm/; revision=2364
-rw-r--r-- | libyasm/value.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libyasm/value.c b/libyasm/value.c index a49daa03..e85d54b2 100644 --- a/libyasm/value.c +++ b/libyasm/value.c @@ -453,10 +453,17 @@ yasm_value_finalize_expr(yasm_value *value, yasm_expr *e, yasm_value_initialize(value, NULL, size); return 0; } + yasm_value_initialize(value, e, size); + return yasm_value_finalize(value, precbc); +} - yasm_value_initialize(value, - yasm_expr__level_tree(e, 1, 1, 0, 0, NULL, NULL), - size); +int +yasm_value_finalize(yasm_value *value, yasm_bytecode *precbc) +{ + if (!value->abs) + return 0; + + value->abs = yasm_expr__level_tree(value->abs, 1, 1, 0, 0, NULL, NULL); /* quit early if there was an issue in simplify() */ if (yasm_error_occurred()) @@ -549,13 +556,6 @@ yasm_value_finalize_expr(yasm_value *value, yasm_expr *e, return 0; } -int -yasm_value_finalize(yasm_value *value, yasm_bytecode *precbc) -{ - unsigned int valsize = value->size; - return yasm_value_finalize_expr(value, value->abs, precbc, valsize); -} - yasm_intnum * yasm_value_get_intnum(yasm_value *value, yasm_bytecode *bc, int calc_bc_dist) { |