[PATCH 3/6] qemuDomainBuildNamespace: Make @devPath const

Michal Privoznik posted 6 patches 9 weeks ago

[PATCH 3/6] qemuDomainBuildNamespace: Make @devPath const

Posted by Michal Privoznik 9 weeks ago
The @devPath variable is not modifiable. It merely just points to
string containing path where private devtmpfs is being
constructed. Make it const so it doesn't look weird that it's not
freed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 2724607311..a4c07fffcb 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -15176,7 +15176,7 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
                          virDomainObjPtr vm)
 {
     struct qemuDomainCreateDeviceData data;
-    char *devPath = NULL;
+    const char *devPath = NULL;
     char **devMountsPath = NULL, **devMountsSavePath = NULL;
     size_t ndevMountsPath = 0, i;
     int ret = -1;
-- 
2.24.1

Re: [PATCH 3/6] qemuDomainBuildNamespace: Make @devPath const

Posted by Pavel Mores 9 weeks ago
On Wed, Mar 18, 2020 at 06:32:13PM +0100, Michal Privoznik wrote:
> The @devPath variable is not modifiable. It merely just points to
> string containing path where private devtmpfs is being
> constructed. Make it const so it doesn't look weird that it's not
> freed.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_domain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 2724607311..a4c07fffcb 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -15176,7 +15176,7 @@ qemuDomainBuildNamespace(virQEMUDriverConfigPtr cfg,
>                           virDomainObjPtr vm)
>  {
>      struct qemuDomainCreateDeviceData data;
> -    char *devPath = NULL;
> +    const char *devPath = NULL;
>      char **devMountsPath = NULL, **devMountsSavePath = NULL;
>      size_t ndevMountsPath = 0, i;
>      int ret = -1;
> -- 
> 2.24.1
> 

Reviewed-by: Pavel Mores <pmores@redhat.com>