From 9e6d6fdaa212f46fd6dc3b6e99a3ff0d99065a93 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 8 May 2018 20:42:31 +0300 Subject: [PATCH] Eliminate source code duplication in stubborn.c (code refactoring) * stubborn.c (GC_malloc_stubborn, GC_end_stubborn_change, GC_change_stubborn): De-duplicate definition (for MANUAL_VDB and non-MANUAL_VDB cases). --- stubborn.c | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/stubborn.c b/stubborn.c index cc5d08a..05592cc 100644 --- a/stubborn.c +++ b/stubborn.c @@ -23,34 +23,21 @@ /* by a stack. */ void GC_dirty(ptr_t p); +#endif - GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_stubborn(size_t lb) - { - return(GC_malloc(lb)); - } +GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_stubborn(size_t lb) +{ + return(GC_malloc(lb)); +} - GC_API void GC_CALL GC_end_stubborn_change(const void *p) - { +GC_API void GC_CALL GC_end_stubborn_change(const void *p GC_ATTR_UNUSED) +{ +# ifdef MANUAL_VDB GC_dirty((ptr_t)p); - } +# endif +} - GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED) - { - } - -#else /* !MANUAL_VDB */ - - GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_stubborn(size_t lb) - { - return(GC_malloc(lb)); - } - - GC_API void GC_CALL GC_end_stubborn_change(const void *p GC_ATTR_UNUSED) - { - } - - GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED) - { - } - -#endif /* !MANUAL_VDB */ +GC_API void GC_CALL GC_change_stubborn(const void *p GC_ATTR_UNUSED) +{ + /* Empty. */ +} -- 2.7.4