Stefan Hajnoczi <stefa...@gmail.com> writes:

> On Wed, Jan 16, 2013 at 06:32:17PM +0100, Markus Armbruster wrote:
>> diff --git a/qemu-log.c b/qemu-log.c
>> index 64a1b88..30c8b01 100644
>> --- a/qemu-log.c
>> +++ b/qemu-log.c
>> @@ -21,10 +21,12 @@
>>  #include "qemu/log.h"
>>  
>>  #ifdef WIN32
>> -static const char *logfilename = "qemu.log";
>> +#define DEFAULT_LOGFILENAME "qemu.log"
>>  #else
>> -static const char *logfilename = "/tmp/qemu.log";
>> +#define DEFAULT_LOGFILENAME "/tmp/qemu.log"
>>  #endif
>> +
>> +static const char *logfilename;
> [...]
>> @@ -84,6 +88,7 @@ void qemu_set_log(int log_flags, bool use_own_buffers)
>>  
>>  void cpu_set_log_filename(const char *filename)
>>  {
>> +    g_free((void *)logfilename);
>
> Might as well drop the const from the variable declaration to indicate
> that we allocate/free this string.

Never thought of const that way.  Dropping const from logfilename is
fine with me.

I wish free()'s parameter was const void *.  Can't be changed now.  Sad
that glib didn't get it right either.

Reply via email to