tools/xl: Fix uninitialized variable error.
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 28 Aug 2012 13:46:30 +0000 (14:46 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 28 Aug 2012 13:46:30 +0000 (14:46 +0100)
commitefbb5c54110baf958e2ae5681e08eb25aa26c62d
tree7ae76b9addd0c0df0e50f1c081494150a438c254
parent37d7ccdc2f50d659f1eb8ec11ee4bf8a8376926d
tools/xl: Fix uninitialized variable error.

c/s 25779:4ca40e0559c3 introduced a compilation error for any build
system using -Werror=uninitialized, such as the default CentOS 5.7
version of gcc.

And with good reason, because if the global libxl
default_output_format is neither OUTPUT_FORMAT_SXP nor
OUTPUT_FORMAT_JSON, the variable hand will be used before being
initialised.

The attached patch fixes the warning, and futher fixes the logic to
work correctly when a new OUTPUT_FORMAT is added to xl.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/xl_cmdimpl.c