Re: [PATCH for-11.0 v2 2/7] Revert "error: define g_autoptr() cleanup function for the Error type"

2025-12-01 Thread Cédric Le Goater

On 12/1/25 20:45, Peter Xu wrote:

This reverts commit 18eb55546a54e443d94a4c49286348176ad4b00a.

Due to the nature of how Error should be used (normally ownership will be
passed over to Error APIs, like error_report_err), auto-free functions may
be error prone on its own.  The auto cleanup function was merged without
proper review as pointed out by Dan and Markus:

https://lore.kernel.org/r/[email protected]

Cc: Cédric Le Goater 
Acked-by: Maciej S. Szmigiero 
Reviewed-by: Markus Armbruster 
Signed-off-by: Peter Xu 
---
  include/qapi/error.h | 2 --
  1 file changed, 2 deletions(-)

diff --git a/include/qapi/error.h b/include/qapi/error.h
index b16c6303f8..f3ce4a4a2d 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -437,8 +437,6 @@ Error *error_copy(const Error *err);
   */
  void error_free(Error *err);
  
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(Error, error_free)

-
  /*
   * Convenience function to assert that *@errp is set, then silently free it.
   */



Reviewed-by: Cédric Le Goater 

Thanks,

C.





[PATCH for-11.0 v2 2/7] Revert "error: define g_autoptr() cleanup function for the Error type"

2025-12-01 Thread Peter Xu
This reverts commit 18eb55546a54e443d94a4c49286348176ad4b00a.

Due to the nature of how Error should be used (normally ownership will be
passed over to Error APIs, like error_report_err), auto-free functions may
be error prone on its own.  The auto cleanup function was merged without
proper review as pointed out by Dan and Markus:

https://lore.kernel.org/r/[email protected]

Cc: Cédric Le Goater 
Acked-by: Maciej S. Szmigiero 
Reviewed-by: Markus Armbruster 
Signed-off-by: Peter Xu 
---
 include/qapi/error.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/qapi/error.h b/include/qapi/error.h
index b16c6303f8..f3ce4a4a2d 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -437,8 +437,6 @@ Error *error_copy(const Error *err);
  */
 void error_free(Error *err);
 
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(Error, error_free)
-
 /*
  * Convenience function to assert that *@errp is set, then silently free it.
  */
-- 
2.50.1