[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] use g_path_get_basename instead of basename
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] use g_path_get_basename instead of basename |
Date: |
Thu, 1 Mar 2018 12:19:58 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 01/03/2018 08:08, Julia Suvorova wrote:
> +static void free_progname(void)
> +{
> + g_free(progname);
> +}
> +
> static void GCC_FMT_ATTR(2, 3) readline_printf_func(void *opaque,
> const char *fmt, ...)
> {
> @@ -504,7 +509,8 @@ int main(int argc, char **argv)
> #endif
>
> module_call_init(MODULE_INIT_TRACE);
> - progname = basename(argv[0]);
> + progname = g_path_get_basename(argv[0]);
> + atexit(free_progname);
This atexit is not needed; memory is always freed on exit. But, it's
good that you thought about it!
I can queue this patch for merging once I get an ack from Alex
Williamson (VFIO).
Thanks,
Paolo