From: Ivan Maidanski Date: Tue, 8 May 2018 17:42:31 +0000 (+0300) Subject: Eliminate source code duplication in stubborn.c X-Git-Tag: v8.0.0~194 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e6d6fdaa212f46fd6dc3b6e99a3ff0d99065a93;p=gc 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). --- diff --git a/stubborn.c b/stubborn.c index cc5d08ae..05592cc3 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. */ +}