]> granicus.if.org Git - yasm/commitdiff
Implement yasm_value_finalize_expr() using yasm_value_finalize().
authorPeter Johnson <peter@tortall.net>
Wed, 18 Aug 2010 06:23:06 +0000 (06:23 -0000)
committerPeter Johnson <peter@tortall.net>
Wed, 18 Aug 2010 06:23:06 +0000 (06:23 -0000)
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

libyasm/value.c

index a49daa03fad2faceff7442d324749e267366b74a..e85d54b2a8dcde64ec1d0f351318fdf410c99096 100644 (file)
@@ -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)
 {