[PATCH 1/2] qemu_domainjob: Drop 'const' from strings in _qemuDomainJobObj

Michal Privoznik posted 2 patches 4 years, 9 months ago
There is a newer version of this series
[PATCH 1/2] qemu_domainjob: Drop 'const' from strings in _qemuDomainJobObj
Posted by Michal Privoznik 4 years, 9 months ago
These strings are not constant really. They are allocated in
qemuDomainObjBeginJobInternal() and freed in
qemuDomainReset*Job(). Freeing a pointer to const looks weird.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_domainjob.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h
index 75cf1deb6a..46cbb8a067 100644
--- a/src/qemu/qemu_domainjob.h
+++ b/src/qemu/qemu_domainjob.h
@@ -179,20 +179,20 @@ struct _qemuDomainJobObj {
     /* The following members are for QEMU_JOB_* */
     qemuDomainJob active;               /* Currently running job */
     unsigned long long owner;           /* Thread id which set current job */
-    const char *ownerAPI;               /* The API which owns the job */
+    char *ownerAPI;                     /* The API which owns the job */
     unsigned long long started;         /* When the current job started */
 
     /* The following members are for QEMU_AGENT_JOB_* */
     qemuDomainAgentJob agentActive;     /* Currently running agent job */
     unsigned long long agentOwner;      /* Thread id which set current agent job */
-    const char *agentOwnerAPI;          /* The API which owns the agent job */
+    char *agentOwnerAPI;                /* The API which owns the agent job */
     unsigned long long agentStarted;    /* When the current agent job started */
 
     /* The following members are for QEMU_ASYNC_JOB_* */
     virCond asyncCond;                  /* Use to coordinate with async jobs */
     qemuDomainAsyncJob asyncJob;        /* Currently active async job */
     unsigned long long asyncOwner;      /* Thread which set current async job */
-    const char *asyncOwnerAPI;          /* The API which owns the async job */
+    char *asyncOwnerAPI;                /* The API which owns the async job */
     unsigned long long asyncStarted;    /* When the current async job started */
     int phase;                          /* Job phase (mainly for migrations) */
     unsigned long long mask;            /* Jobs allowed during async job */
-- 
2.26.3

Re: [PATCH 1/2] qemu_domainjob: Drop 'const' from strings in _qemuDomainJobObj
Posted by Pavel Hrdina 4 years, 9 months ago
On Fri, Apr 30, 2021 at 07:18:48AM +0200, Michal Privoznik wrote:
> These strings are not constant really. They are allocated in
> qemuDomainObjBeginJobInternal() and freed in
> qemuDomainReset*Job(). Freeing a pointer to const looks weird.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_domainjob.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>