On 23/01/2020 12.38, Igor Mammedov wrote:
> Use GString to pass argument to make_cli() so that it would be easy
> to dynamically change test case arguments from main(). The follow up
> patch will use it to change RAM size options depending on target.
>
> While at it cleanup 'cli' freeing, using g_autofree annotation.
>
> Signed-off-by: Igor Mammedov <[email protected]>
> ---
[...]
> @@ -539,11 +539,11 @@ static void pc_hmat_erange_cfg(const void *data)
>
> int main(int argc, char **argv)
> {
> - const char *args = NULL;
> + g_autoptr(GString) args = g_string_new("");
Nit: You could use g_string_new(NULL) here to save two bytes ;-)
> const char *arch = qtest_get_arch();
>
> - if (strcmp(arch, "aarch64") == 0) {
> - args = "-machine virt";
> + if (g_str_equal(arch, "aarch64")) {
> + g_string_append(args, " -machine virt");
> }
>
> g_test_init(&argc, &argv, NULL);
>
Reviewed-by: Thomas Huth <[email protected]>