Hello Daniel, Peter,

Apologies for the accidental noreply mail in the CC, it's probably the 
"supresscc = self" line that I copied blindly into my send-email git config. 
Also, many apologies for forgetting to at least compile the change. I have read 
the guidelines before but I forgot.

Question: After I amend the commit with the right changes, should I simply call 
"git publish" again?

I tested this in a small repo I made and the behaviour is that "git publish" 
starts a new email chain with [PATCH v2]. Is this what should happen or is it 
required for the new PATCH to be a reply to this chain?

Cheers,
Mostafa
________________________________
From: Daniel P. Berrangé <berra...@redhat.com>
Sent: Monday, March 11, 2024 9:24 AM
To: Mostafa <rece...@outlook.com>
Cc: devel@lists.libvirt.org <devel@lists.libvirt.org>
Subject: Re: [PATCH] Remove VIR_FREE in favor of g_autofree in some functions 
in libvrit-domain.c

On Mon, Mar 11, 2024 at 02:15:32AM +0200, Mostafa wrote:
> From: مصطفي محمود كمال الدين <48567303+most...@users.noreply.github.com>
>
> ---
>  src/libvirt-domain.c | 32 ++++++++------------------------
>  1 file changed, 8 insertions(+), 24 deletions(-)
>
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index 83abad251e..9b68a7ac95 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -884,7 +884,7 @@ virDomainSave(virDomainPtr domain, const char *to)
>
>      if (conn->driver->domainSave) {
>          int ret;
> -        char *absolute_to;
> +        g_autofree char *absolute_to;

All variables declared with 'g_autofree' *must* be initialized
at time of declaration, so you need to add ' = NULL' here and
to all the other similar changes.

>
>          /* We must absolutize the file path as the save is done out of 
> process */
>          if (!(absolute_to = g_canonicalize_filename(to, NULL))) {
> @@ -895,8 +895,6 @@ virDomainSave(virDomainPtr domain, const char *to)
>
>          ret = conn->driver->domainSave(domain, absolute_to);
>
> -        VIR_FREE(absolute_to);
> -
>          if (ret < 0)
>              goto error;
>          return ret;
> @@ -974,7 +972,7 @@ virDomainSaveFlags(virDomainPtr domain, const char *to,
>
>      if (conn->driver->domainSaveFlags) {
>          int ret;
> -        char *absolute_to;
> +        g_autofree char *absolute_to;
>
>          /* We must absolutize the file path as the save is done out of 
> process */
>          if (!(absolute_to = g_canonicalize_filename(to, NULL))) {
> @@ -985,8 +983,6 @@ virDomainSaveFlags(virDomainPtr domain, const char *to,
>
>          ret = conn->driver->domainSaveFlags(domain, absolute_to, dxml, 
> flags);
>
> -        VIR_FREE(absolute_to);
> -
>          if (ret < 0)
>              goto error;
>          return ret;
> @@ -1076,7 +1072,7 @@ virDomainRestore(virConnectPtr conn, const char *from)
>
>      if (conn->driver->domainRestore) {
>          int ret;
> -        char *absolute_from;
> +        g_autofree char *absolute_from;
>
>          /* We must absolutize the file path as the restore is done out of 
> process */
>          if (!(absolute_from = g_canonicalize_filename(from, NULL))) {
> @@ -1087,8 +1083,6 @@ virDomainRestore(virConnectPtr conn, const char *from)
>
>          ret = conn->driver->domainRestore(conn, absolute_from);
>
> -        VIR_FREE(absolute_from);
> -
>          if (ret < 0)
>              goto error;
>          return ret;
> @@ -1156,7 +1150,7 @@ virDomainRestoreFlags(virConnectPtr conn, const char 
> *from, const char *dxml,
>
>      if (conn->driver->domainRestoreFlags) {
>          int ret;
> -        char *absolute_from;
> +        g_autofree char *absolute_from;
>
>          /* We must absolutize the file path as the restore is done out of 
> process */
>          if (!(absolute_from = g_canonicalize_filename(from, NULL))) {
> @@ -1168,8 +1162,6 @@ virDomainRestoreFlags(virConnectPtr conn, const char 
> *from, const char *dxml,
>          ret = conn->driver->domainRestoreFlags(conn, absolute_from, dxml,
>                                                 flags);
>
> -        VIR_FREE(absolute_from);
> -
>          if (ret < 0)
>              goto error;
>          return ret;
> @@ -1263,7 +1255,7 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const 
> char *file,
>
>      if (conn->driver->domainSaveImageGetXMLDesc) {
>          char *ret;
> -        char *absolute_file;
> +        g_autofree char *absolute_file;
>
>          /* We must absolutize the file path as the read is done out of 
> process */
>          if (!(absolute_file = g_canonicalize_filename(file, NULL))) {
> @@ -1275,8 +1267,6 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const 
> char *file,
>          ret = conn->driver->domainSaveImageGetXMLDesc(conn, absolute_file,
>                                                        flags);
>
> -        VIR_FREE(absolute_file);
> -
>          if (!ret)
>              goto error;
>          return ret;
> @@ -1338,7 +1328,7 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const 
> char *file,
>
>      if (conn->driver->domainSaveImageDefineXML) {
>          int ret;
> -        char *absolute_file;
> +        g_autofree char *absolute_file;
>
>          /* We must absolutize the file path as the read is done out of 
> process */
>          if (!(absolute_file = g_canonicalize_filename(file, NULL))) {
> @@ -1350,8 +1340,6 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const 
> char *file,
>          ret = conn->driver->domainSaveImageDefineXML(conn, absolute_file,
>                                                       dxml, flags);
>
> -        VIR_FREE(absolute_file);
> -
>          if (ret < 0)
>              goto error;
>          return ret;
> @@ -1415,7 +1403,7 @@ virDomainCoreDump(virDomainPtr domain, const char *to, 
> unsigned int flags)
>
>      if (conn->driver->domainCoreDump) {
>          int ret;
> -        char *absolute_to;
> +        g_autofree char *absolute_to;
>
>          /* We must absolutize the file path as the save is done out of 
> process */
>          if (!(absolute_to = g_canonicalize_filename(to, NULL))) {
> @@ -1426,8 +1414,6 @@ virDomainCoreDump(virDomainPtr domain, const char *to, 
> unsigned int flags)
>
>          ret = conn->driver->domainCoreDump(domain, absolute_to, flags);
>
> -        VIR_FREE(absolute_to);
> -
>          if (ret < 0)
>              goto error;
>          return ret;
> @@ -1501,7 +1487,7 @@ virDomainCoreDumpWithFormat(virDomainPtr domain, const 
> char *to,
>
>      if (conn->driver->domainCoreDumpWithFormat) {
>          int ret;
> -        char *absolute_to;
> +        g_autofree char *absolute_to;
>
>          /* We must absolutize the file path as the save is done out of 
> process */
>          if (!(absolute_to = g_canonicalize_filename(to, NULL))) {
> @@ -1513,8 +1499,6 @@ virDomainCoreDumpWithFormat(virDomainPtr domain, const 
> char *to,
>          ret = conn->driver->domainCoreDumpWithFormat(domain, absolute_to,
>                                                       dumpformat, flags);
>
> -        VIR_FREE(absolute_to);
> -
>          if (ret < 0)
>              goto error;
>          return ret;
> --
> 2.34.1
> _______________________________________________
> Devel mailing list -- devel@lists.libvirt.org
> To unsubscribe send an email to devel-le...@lists.libvirt.org

With regards,
Daniel
--
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-le...@lists.libvirt.org

Reply via email to