When you know what you do, it could make sense to remove all magic check

from Evas and win some speed boost. Use really carefully.

Still turn MAGIC_DEBUG on by default.


SVN revision: 35965
This commit is contained in:
Cedric BAIL 2008-09-12 13:14:08 +00:00
parent ac440b9533
commit 665ee944ee
2 changed files with 34 additions and 9 deletions

View File

@ -1367,6 +1367,24 @@ AC_ARG_ENABLE(cpu-c,
]
)
#######################################
## MAGIC_DEBUG
want_evas_magic_debug="yes"
AC_MSG_CHECKING(whether to check magic for evas object)
AC_ARG_ENABLE(evas-magic-debug,
AC_HELP_STRING(
[--disable-evas-magic-debug],
[disable MAGIC_DEBUG check when people pass in wrong object type. [[default=enabled]]]
),
[ want_evas_magic_debug="$enableval" ]
)
AC_MSG_RESULT($want_evas_magic_debug)
AM_CONDITIONAL(EVAS_MAGIC_DEBUG, test "x$want_evas_magic_debug" = "xyes")
if test "x$want_evas_magic_debug" = "xyes"; then
AC_DEFINE(EVAS_MAGIC_DEBUG, 1, [complain when peole pass in wrong object types etc.])
fi
#####################################################################
## ARGB engine options
@ -1797,6 +1815,7 @@ echo " MMX.....................: $build_cpu_mmx"
echo " SSE.....................: $build_cpu_sse"
echo " ALTIVEC.................: $build_cpu_altivec"
echo " Thread Support..........: $build_pthreads"
echo " MAGIC_DEBUG.............: $want_evas_magic_debug"
echo
echo "Async Events..............: $build_async_events"
echo

View File

@ -5,14 +5,19 @@
#define _GNU_SOURCE
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Evas.h"
#include "../file/evas_module.h"
#include "../file/evas_path.h"
#ifdef EVAS_MAGIC_DEBUG
/* complain when peole pass in wrong object types etc. */
#define MAGIC_DEBUG
# define MAGIC_DEBUG
#endif
#define RENDER_METHOD_INVALID 0x00000000
@ -59,20 +64,21 @@ typedef struct _Evas_Rectangles Evas_Rectangles;
#define MAGIC_OBJ_CUSTOM 0x72777775
#ifdef MAGIC_DEBUG
#define MAGIC_CHECK_FAILED(o, t, m) \
# define MAGIC_CHECK_FAILED(o, t, m) \
{evas_debug_error(); \
if (!o) evas_debug_input_null(); \
else if (((t *)o)->magic == 0) evas_debug_magic_null(); \
else evas_debug_magic_wrong((m), ((t *)o)->magic); \
}
#else
#define MAGIC_CHECK_FAILED(o, t, m)
#endif
#define MAGIC_CHECK(o, t, m) \
# define MAGIC_CHECK(o, t, m) \
{if ((!o) || (!(((t *)o)->magic == (m)))) { \
MAGIC_CHECK_FAILED(o, t, m)
#define MAGIC_CHECK_END() \
}}
# define MAGIC_CHECK_END() }}
#else
# define MAGIC_CHECK_FAILED(o, t, m)
# define MAGIC_CHECK(o, t, m) { if (!o) {
# define MAGIC_CHECK_END() }}
#endif
#define NEW_RECT(_r, _x, _y, _w, _h) \
{(_r) = malloc(sizeof(Evas_Rectangle)); \