diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-06 11:25:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-06 11:25:50 +0400 |
commit | 43fb105ff11b4654e5ce6443ad92a71bf9320757 (patch) | |
tree | f839176670d3beeed89ca89ab9f62d7fbc623bd4 /intern/guardedalloc | |
parent | 43a201662a931a16027d4a088b675246df03c330 (diff) |
Move LIKELY/UNLIKELY into header
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r-- | intern/guardedalloc/intern/mallocn.c | 5 | ||||
-rw-r--r-- | intern/guardedalloc/intern/mallocn_guarded_impl.c | 8 | ||||
-rw-r--r-- | intern/guardedalloc/intern/mallocn_intern.h | 8 | ||||
-rw-r--r-- | intern/guardedalloc/intern/mallocn_lockfree_impl.c | 13 |
4 files changed, 8 insertions, 26 deletions
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index 4d00616202e..e85fba7a6d0 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -15,11 +15,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * * Contributor(s): Brecht Van Lommel * Campbell Barton * diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c index d86adcf2a7c..172c79d50cd 100644 --- a/intern/guardedalloc/intern/mallocn_guarded_impl.c +++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c @@ -222,14 +222,6 @@ static bool malloc_debug_memset = false; /* --------------------------------------------------------------------- */ #ifdef __GNUC__ -# define LIKELY(x) __builtin_expect(!!(x), 1) -# define UNLIKELY(x) __builtin_expect(!!(x), 0) -#else -# define LIKELY(x) (x) -# define UNLIKELY(x) (x) -#endif - -#ifdef __GNUC__ __attribute__ ((format(printf, 1, 2))) #endif static void print_error(const char *str, ...) diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h index db45b59b884..b0fd52d2766 100644 --- a/intern/guardedalloc/intern/mallocn_intern.h +++ b/intern/guardedalloc/intern/mallocn_intern.h @@ -77,6 +77,14 @@ #define SIZET_ALIGN_4(len) ((len + 3) & ~(size_t)3) +#ifdef __GNUC__ +# define LIKELY(x) __builtin_expect(!!(x), 1) +# define UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +# define LIKELY(x) (x) +# define UNLIKELY(x) (x) +#endif + /* Prototypes for counted allocator functions */ size_t MEM_lockfree_allocN_len(const void *vmemh) ATTR_WARN_UNUSED_RESULT; void MEM_lockfree_freeN(void *vmemh); diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.c b/intern/guardedalloc/intern/mallocn_lockfree_impl.c index ccda439e29a..6fc01807af3 100644 --- a/intern/guardedalloc/intern/mallocn_lockfree_impl.c +++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.c @@ -15,11 +15,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * * Contributor(s): Brecht Van Lommel * Campbell Barton * Sergey Sharybin @@ -64,14 +59,6 @@ static void (*thread_unlock_callback)(void) = NULL; #define MEMHEAD_IS_MMAP(memhead) ((memhead)->len & (size_t) 1) #ifdef __GNUC__ -# define LIKELY(x) __builtin_expect(!!(x), 1) -# define UNLIKELY(x) __builtin_expect(!!(x), 0) -#else -# define LIKELY(x) (x) -# define UNLIKELY(x) (x) -#endif - -#ifdef __GNUC__ __attribute__ ((format(printf, 1, 2))) #endif static void print_error(const char *str, ...) |