[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 08/13] vl: relocate paths to data directories
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH 08/13] vl: relocate paths to data directories |
Date: |
Wed, 2 Sep 2020 10:35:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
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.
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
- [PATCH 07/13] net: relocate paths to helpers and scripts, (continued)
- [PATCH 07/13] net: relocate paths to helpers and scripts, Paolo Bonzini, 2020/09/01
- [PATCH 09/13] vl: relocate path to configuration file, Paolo Bonzini, 2020/09/01
- [PATCH 06/13] module: relocate path to modules, Paolo Bonzini, 2020/09/01
- [PATCH 02/13] oslib: do not call g_strdup from qemu_get_exec_dir, Paolo Bonzini, 2020/09/01
- [PATCH 08/13] vl: relocate paths to data directories, Paolo Bonzini, 2020/09/01
- [PATCH 12/13] ui: relocate paths to icons and translations, Paolo Bonzini, 2020/09/01
- [PATCH 13/13] configure: use a platform-neutral prefix, Paolo Bonzini, 2020/09/01
- [PATCH 10/13] qemu-bridge-helper: relocate path to default ACL, Paolo Bonzini, 2020/09/01
- [PATCH 04/13] cutils: introduce get_relocated_path, Paolo Bonzini, 2020/09/01
- [PATCH 11/13] qga: relocate path to default configuration and hook, Paolo Bonzini, 2020/09/01
- Re: [PATCH 00/13] Make QEMU installation relocatable, Mark Cave-Ayland, 2020/09/01