qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 08/13] vl: relocate paths to data directories


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 08/13] vl: relocate paths to data directories
Date: Wed, 2 Sep 2020 10:41:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 9/2/20 10:35 AM, Paolo Bonzini wrote:
> On 02/09/20 10:28, Philippe Mathieu-Daudé wrote:
>>>  
>>> -void qemu_add_data_dir(const char *path)
>>> +void qemu_add_data_dir(char *path)
>> But we have 'const char *data_dir[16];', why remove the const?
> 
> In order to free duplicates: before this patch the directory can be
> statically- or stack-allocated, now it's always heap-allocated.

Oh I missed that, thanks.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> 
> Paolo
> 
>>  {
>>      int i;
>>  
>> @@ -2017,10 +2017,11 @@ void qemu_add_data_dir(const char *path)
>>      }
>>      for (i = 0; i < data_dir_idx; i++) {
>>          if (strcmp(data_dir[i], path) == 0) {
>> -            return; /* duplicate */
>> +            g_free(path); /* duplicate */
>> +            return;
>>          }
>>      }
>> -    data_dir[data_dir_idx++] = g_strdup(path);
>> +    data_dir[data_dir_idx++] = path;
>>  }
> 
> Paolo
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]