widl: Simplify write_struct_tfs and remove an unused variable.

Gerald Pfeifer gerald at pfeifer.com
Sun May 2 13:48:39 CDT 2010


Using function invocations with side effects in the ternary ? : is
rarely a good idea, and in this case array_offset is not even used
thereafter.

Gerald
---
 tools/widl/typegen.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 694e98d..8541c5a 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2452,7 +2452,6 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
     unsigned int total_size;
     const var_t *array;
     unsigned int start_offset;
-    unsigned int array_offset;
     unsigned int align;
     unsigned int corroff;
     var_t *f;
@@ -2473,10 +2472,12 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
 
     array = find_array_or_string_in_struct(type);
     if (array && !processed(array->type))
-        array_offset
-            = is_string_type(array->attrs, array->type)
-            ? write_string_tfs(file, array->attrs, array->type, FALSE, array->name, tfsoff)
-            : write_array_tfs(file, array->attrs, array->type, array->name, tfsoff);
+    {
+        if(is_string_type(array->attrs, array->type))
+            write_string_tfs(file, array->attrs, array->type, FALSE, array->name, tfsoff);
+        else
+            write_array_tfs(file, array->attrs, array->type, array->name, tfsoff);
+    }
 
     corroff = *tfsoff;
     write_descriptors(file, type, tfsoff);
-- 
1.6.6.2



More information about the wine-patches mailing list