[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 3/7] trace: move qemu_trace_opts to trace/contro
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [PATCH 3/7] trace: move qemu_trace_opts to trace/control.c |
Date: |
Fri, 17 Jun 2016 14:48:22 +0100 |
User-agent: |
Mutt/1.6.1 (2016-04-27) |
On Thu, Jun 16, 2016 at 10:15:08AM +0300, Denis V. Lunev wrote:
> +/**
> + * Definition of QEMU options describing trace subsystem configuration
> + */
> +extern QemuOptsList qemu_trace_opts;
> +
> +/**
> + * trace_opt_parse:
> + * @optarg: A string argument of --trace command line argument
> + * @trace_file: current filename to save traces to
> + *
> + * Initialize tracing subsystem.
+Returns the filename to save trace to. It must be freed with g_free().
> @@ -3867,23 +3847,8 @@ int main(int argc, char **argv, char **envp)
> xen_mode = XEN_ATTACH;
> break;
> case QEMU_OPTION_trace:
> - {
> - opts = qemu_opts_parse_noisily(qemu_find_opts("trace"),
> - optarg, true);
> - if (!opts) {
> - exit(1);
> - }
> - if (qemu_opt_get(opts, "enable")) {
> - trace_enable_events(qemu_opt_get(opts, "enable"));
> - }
> - trace_init_events(qemu_opt_get(opts, "events"));
> - if (trace_file) {
> - g_free(trace_file);
> - }
> - trace_file = g_strdup(qemu_opt_get(opts, "file"));
> - qemu_opts_del(opts);
> + trace_file = trace_opt_parse(optarg, trace_file);
It's clearer if the caller frees trace_file:
g_free(trace_file);
trace_file = trace_opt_parse(optarg);
Now the memory management is explicit and there is no need to pass
trace_file to trace_opt_parse().
signature.asc
Description: PGP signature
- [Qemu-block] [PATCH 1/7] doc: sync help descriprion for --trace with man for qemu.1, (continued)
- [Qemu-block] [PATCH 1/7] doc: sync help descriprion for --trace with man for qemu.1, Denis V. Lunev, 2016/06/16
- [Qemu-block] [PATCH 2/7] doc: move text describing --trace to specific .texi file, Denis V. Lunev, 2016/06/16
- [Qemu-block] [PATCH 4/7] trace: enable tracing in qemu-io, Denis V. Lunev, 2016/06/16
- [Qemu-block] [PATCH 5/7] trace: enable tracing in qemu-nbd, Denis V. Lunev, 2016/06/16
- [Qemu-block] [PATCH 3/7] trace: move qemu_trace_opts to trace/control.c, Denis V. Lunev, 2016/06/16
- Re: [Qemu-block] [PATCH 3/7] trace: move qemu_trace_opts to trace/control.c,
Stefan Hajnoczi <=
- [Qemu-block] [PATCH 6/7] qemu-img: move common options parsing before commands processing, Denis V. Lunev, 2016/06/16
- [Qemu-block] [PATCH 7/7] trace: enable tracing in qemu-img, Denis V. Lunev, 2016/06/16