forked from enlightenment/efl
Store build information inside eina_config.h, and fix magic use.
SVN revision: 36263
This commit is contained in:
parent
521daa2f9d
commit
6f5b3584dd
|
@ -34,6 +34,27 @@ AC_DEFINE_UNQUOTED(MODULE_ARCH, "${MODULE_ARCH}", "Module architecture")
|
|||
|
||||
### Additional options to configure
|
||||
|
||||
# Magic debug
|
||||
AC_ARG_ENABLE([magic-debug],
|
||||
[AC_HELP_STRING([--enable-magic-debug], [enable magic debug of eina structure])],
|
||||
[
|
||||
if test "x${enableval}" = "xyes" ; then
|
||||
enable_magic_debug="yes"
|
||||
else
|
||||
enable_magic_debug="no"
|
||||
fi
|
||||
],
|
||||
[enable_magic_debug="yes"]
|
||||
)
|
||||
AC_MSG_CHECKING([whether magic debug is enable])
|
||||
AC_MSG_RESULT([${enable_magic_debug}])
|
||||
|
||||
EINA_MAGIC_DEBUG=0
|
||||
if test "x${enable_magic_debug}" = "xyes" ; then
|
||||
EINA_MAGIC_DEBUG=1
|
||||
fi
|
||||
AC_SUBST(EINA_MAGIC_DEBUG)
|
||||
|
||||
# Unit tests
|
||||
|
||||
AC_ARG_ENABLE([tests],
|
||||
|
@ -304,6 +325,7 @@ eina.pc
|
|||
doc/Makefile
|
||||
src/Makefile
|
||||
src/include/Makefile
|
||||
src/include/eina_config.h
|
||||
src/lib/Makefile
|
||||
src/modules/Makefile
|
||||
src/modules/mp/Makefile
|
||||
|
@ -339,6 +361,7 @@ echo " Evas...............: ${have_evas}"
|
|||
echo " Ecore..............: ${have_ecore}"
|
||||
echo " E17 real data......: ${enable_bench_e17}"
|
||||
fi
|
||||
echo " Magic debug..........: ${enable_magic_debug}"
|
||||
echo
|
||||
echo " Memory pool:"
|
||||
echo " Ememoa.............: ${enable_ememoa}"
|
||||
|
|
|
@ -136,6 +136,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "eina_config.h"
|
||||
#include "eina_types.h"
|
||||
#include "eina_f16p16.h"
|
||||
#include "eina_rectangle.h"
|
||||
|
|
|
@ -27,8 +27,10 @@ eina_inline_rbtree.x \
|
|||
eina_inline_mempool.x \
|
||||
eina_iterator.h
|
||||
|
||||
EXTRA_DIST = eina_config.h.in
|
||||
|
||||
installed_mainheaderdir = $(prefix)/include/eina-@VMAJ@
|
||||
installed_mainheader_DATA = Eina.h
|
||||
installed_mainheader_DATA = Eina.h eina_config.h
|
||||
|
||||
installed_headersdir = $(prefix)/include/eina-@VMAJ@/eina
|
||||
installed_headers_DATA = $(EINAHEADERS)
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "eina_config.h"
|
||||
|
||||
#include "eina_types.h"
|
||||
#include "eina_error.h"
|
||||
#include "eina_iterator.h"
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/* EINA - EFL data type library
|
||||
* Copyright (C) 2008 Cedric Bail
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library;
|
||||
* if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef EINA_CONFIG_H_
|
||||
#define EINA_CONFIG_H_
|
||||
|
||||
#undef EINA_MAGIC_DEBUG
|
||||
#if @EINA_MAGIC_DEBUG@
|
||||
#define EINA_MAGIC_DEBUG
|
||||
#endif
|
||||
|
||||
#endif /* EINA_CONFIG_H_ */
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "eina_config.h"
|
||||
|
||||
#include "eina_types.h"
|
||||
#include "eina_iterator.h"
|
||||
#include "eina_accessor.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef EINA_MAGIC_H_
|
||||
#define EINA_MAGIC_H_
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef EINA_MAGIC_DEBUG
|
||||
|
||||
#include "eina_types.h"
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "eina_config.h"
|
||||
|
||||
#include "eina_magic.h"
|
||||
#include "eina_iterator.h"
|
||||
#include "eina_accessor.h"
|
||||
|
|
|
@ -20,15 +20,16 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef DEBUG
|
||||
# define DEBUG
|
||||
#endif
|
||||
#define EINA_MAGIC_DEBUG
|
||||
#include "eina_magic.h"
|
||||
|
||||
#include "eina_config.h"
|
||||
#include "eina_private.h"
|
||||
#include "eina_array.h"
|
||||
#include "eina_error.h"
|
||||
#include "eina_inlist.h"
|
||||
|
||||
/*============================================================================*
|
||||
* Local *
|
||||
|
@ -37,12 +38,14 @@
|
|||
typedef struct _Eina_Magic_String Eina_Magic_String;
|
||||
struct _Eina_Magic_String
|
||||
{
|
||||
EINA_INLIST;
|
||||
|
||||
char *string;
|
||||
Eina_Magic magic;
|
||||
};
|
||||
|
||||
static int _eina_magic_string_count = 0;
|
||||
static Eina_Array *strings = NULL;
|
||||
static Eina_Inlist *strings = NULL;
|
||||
|
||||
/*============================================================================*
|
||||
* Global *
|
||||
|
@ -57,9 +60,6 @@ eina_magic_string_init()
|
|||
{
|
||||
++_eina_magic_string_count;
|
||||
|
||||
if (_eina_magic_string_count == 1)
|
||||
strings = eina_array_new(8);
|
||||
|
||||
return _eina_magic_string_count;
|
||||
}
|
||||
|
||||
|
@ -70,24 +70,28 @@ eina_magic_string_shutdown()
|
|||
|
||||
if (_eina_magic_string_count == 0)
|
||||
{
|
||||
eina_array_free(strings);
|
||||
strings = NULL;
|
||||
/* Free all strings. */
|
||||
while (strings)
|
||||
{
|
||||
Eina_Magic_String *tmp;
|
||||
|
||||
tmp = (Eina_Magic_String*) strings;
|
||||
strings = eina_inlist_remove(strings, strings);
|
||||
|
||||
free(tmp->string);
|
||||
free(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
return _eina_magic_string_count;
|
||||
}
|
||||
|
||||
|
||||
EAPI const char*
|
||||
eina_magic_string_get(Eina_Magic magic)
|
||||
{
|
||||
Eina_Magic_String *ems;
|
||||
Eina_Array_Iterator it;
|
||||
unsigned int i;
|
||||
|
||||
if (!strings) return NULL;
|
||||
|
||||
EINA_ARRAY_ITER_NEXT(strings, i, ems, it)
|
||||
EINA_INLIST_ITER_NEXT(strings, ems)
|
||||
if (ems->magic == magic)
|
||||
return ems->string;
|
||||
|
||||
|
@ -98,12 +102,8 @@ EAPI void
|
|||
eina_magic_string_set(Eina_Magic magic, const char *magic_name)
|
||||
{
|
||||
Eina_Magic_String *ems;
|
||||
Eina_Array_Iterator it;
|
||||
unsigned int i;
|
||||
|
||||
if (!strings) return ;
|
||||
|
||||
EINA_ARRAY_ITER_NEXT(strings, i, ems, it)
|
||||
EINA_INLIST_ITER_NEXT(strings, ems)
|
||||
if (ems->magic == magic)
|
||||
{
|
||||
free(ems->string);
|
||||
|
@ -121,7 +121,7 @@ eina_magic_string_set(Eina_Magic magic, const char *magic_name)
|
|||
else
|
||||
ems->string = NULL;
|
||||
|
||||
eina_array_push(strings, ems);
|
||||
strings = eina_inlist_prepend(strings, EINA_INLIST_GET(ems));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define EINA_MAGIC_DEBUG
|
||||
|
||||
#include "eina_suite.h"
|
||||
#include "eina_magic.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue