[PATCH 1/4] util: alloc: Remove pointless clearing of variable in AUTOPTR_FUNCs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



VIR_DEFINE_AUTOPTR_FUNC defines a function which is supposed to free the
resources for the given VIR_AUTOPTR variable. Given that the cleanup
function is executed when the stack frame is being destroyed it does not
make much sense to set the pointer to NULL.

Making the inline function contain less code also decreases the
possibility that for a given type the inlining will be declined by the
compiler due to increasing code size.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/viralloc.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index 15451d4673..50a07d4fa3 100644
--- a/src/util/viralloc.h
+++ b/src/util/viralloc.h
@@ -612,7 +612,6 @@ void virAllocTestHook(void (*func)(int, void*), void *data);
     { \
         if (*_ptr) \
             (func)(*_ptr); \
-        *_ptr = NULL; \
     }

 # define VIR_AUTOCLEAN_FUNC_NAME(type) type##AutoClean
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux