forked from enlightenment/efl
Update documentation:
* run 'make doc' to generate the documentation. Hence gendoc disappear. Doxyfile is moved to doc/ * update main page and doc of hash table, but it has to be filled. SVN revision: 35692
This commit is contained in:
parent
394c787dde
commit
9824a1a86c
|
@ -2,7 +2,7 @@
|
|||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = src
|
||||
SUBDIRS = src doc
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
Makefile.in \
|
||||
|
@ -33,6 +33,14 @@ eina.pc
|
|||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = eina.pc
|
||||
|
||||
.PHONY: doc coverage benchmark
|
||||
|
||||
# Documentation
|
||||
|
||||
doc:
|
||||
@echo "entering doc/"
|
||||
make -C doc doc
|
||||
|
||||
# Unit tests
|
||||
|
||||
if EINA_ENABLE_TESTS
|
||||
|
@ -85,12 +93,12 @@ endif
|
|||
if EINA_ENABLE_BENCH
|
||||
|
||||
benchmark:
|
||||
@make -C src bench
|
||||
@make -C src benchmark
|
||||
@mkdir result || true
|
||||
@cd result && ../src/tests/eina_bench `date +%F_%T`
|
||||
|
||||
else
|
||||
|
||||
bench:
|
||||
benchmark:
|
||||
@echo "reconfigure with --enable-bench"
|
||||
endif
|
||||
|
|
|
@ -108,15 +108,18 @@ if test "x${enable_tests}" = "xyes" ; then
|
|||
[enable_tests="no"]
|
||||
)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(EINA_ENABLE_TESTS, test "x${enable_tests}" = "xyes")
|
||||
|
||||
# Check ememoa memory pool library
|
||||
|
||||
PKG_CHECK_MODULES([EMEMOA],
|
||||
if test "x${enable_ememoa}" = "xyes" ; then
|
||||
PKG_CHECK_MODULES([EMEMOA],
|
||||
[ememoa >= 0.0.26 ],
|
||||
[enable_ememoa="yes"],
|
||||
[enable_ememoa="no"]
|
||||
)
|
||||
)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(EINA_ENABLE_EMEMOA, test "x${enable_ememoa}" = "xyes")
|
||||
|
||||
|
@ -136,7 +139,7 @@ if test "x$enable_tests" = "xno" -a "x$enable_coverage" = "xyes" ; then
|
|||
enable_coverage="no"
|
||||
fi
|
||||
|
||||
if test "x$enable_coverage" = "xyes"; then
|
||||
if test "x$enable_coverage" = "xyes" ; then
|
||||
AC_CHECK_PROG(have_lcov, [lcov], [yes], [no])
|
||||
if test "x$have_lcov" = "xyes" ; then
|
||||
COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage"
|
||||
|
@ -153,6 +156,11 @@ AC_SUBST(COVERAGE_LIBS)
|
|||
|
||||
AM_CONDITIONAL(EINA_ENABLE_COVERAGE, test "x${enable_coverage}" = "xyes")
|
||||
|
||||
# doxygen program for documentation building
|
||||
|
||||
EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
|
||||
|
||||
AM_CONDITIONAL(EINA_BUILD_DOC, test "x${build_doc}" = "xyes")
|
||||
|
||||
### Checks for types
|
||||
|
||||
|
@ -166,7 +174,7 @@ AC_C_BIGENDIAN
|
|||
AC_PROG_CC_STDC
|
||||
AC_C___ATTRIBUTE__
|
||||
|
||||
if test "x$enable_coverage" = "xyes"; then
|
||||
if test "x$enable_coverage" = "xyes" ; then
|
||||
CFLAGS="${DEBUG_CFLAGS}"
|
||||
fi
|
||||
|
||||
|
@ -193,6 +201,7 @@ AC_SUBST(lt_enable_auto_import)
|
|||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
eina.pc
|
||||
doc/Makefile
|
||||
src/Makefile
|
||||
src/include/Makefile
|
||||
src/lib/Makefile
|
||||
|
@ -220,6 +229,7 @@ echo
|
|||
echo
|
||||
echo "Configuration Options Summary:"
|
||||
echo
|
||||
echo " Documentation........: ${build_doc}"
|
||||
echo " Tests................: ${enable_tests}"
|
||||
echo " Coverage.............: ${enable_coverage}"
|
||||
echo " Bench................: ${enable_bench}"
|
||||
|
|
|
@ -38,7 +38,7 @@ PROJECT_NUMBER =
|
|||
# If a relative path is entered, it will be relative to the location
|
||||
# where doxygen was started. If left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = doc
|
||||
OUTPUT_DIRECTORY = .
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
|
||||
# 4096 sub-directories (in 2 levels) under the output directory of each output
|
||||
|
@ -513,7 +513,7 @@ WARN_LOGFILE =
|
|||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = ./src/lib
|
||||
INPUT = ../src/
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
.PHONY: doc
|
||||
|
||||
if EINA_BUILD_DOC
|
||||
|
||||
doc: all
|
||||
rm -rf html/ latex/ man/
|
||||
$(DOXYGEN)
|
||||
|
||||
else
|
||||
|
||||
doc:
|
||||
@echo "Documentation not built. Run ./configure --help"
|
||||
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
@rm -rf html/ latex/ man/
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
rm -rf ./doc/html ./doc/latex ./doc/man
|
||||
mkdir -p ./doc/html ./doc/latex ./doc/man 2>/dev/null
|
||||
doxygen
|
||||
#cp doc/img/*.png doc/html/
|
||||
rm -f edata_docs.tar ecore_docs.tar.gz
|
||||
tar -cvf edata_docs.tar doc/html doc/man doc/latex
|
||||
gzip -9f edata_docs.tar
|
||||
exit 0
|
|
@ -0,0 +1,82 @@
|
|||
dnl Configure script for doxygen
|
||||
dnl Vincent Torri 2008-08-25
|
||||
dnl
|
||||
dnl EFL_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for the doxygen program, and define DOXYGEN.
|
||||
dnl
|
||||
AC_DEFUN([EFL_CHECK_DOXYGEN],
|
||||
[
|
||||
|
||||
DOXYGEN="doxygen"
|
||||
|
||||
dnl
|
||||
dnl Disable the build of the documentation
|
||||
dnl
|
||||
AC_ARG_ENABLE([doc],
|
||||
AC_HELP_STRING(
|
||||
[--disable-doc],
|
||||
[Disable the build of the documentation]),
|
||||
[if test "${disable_doc}" = "yes" ; then
|
||||
enable_doc="no"
|
||||
else
|
||||
enable_doc="yes"
|
||||
fi],
|
||||
[enable_doc="yes"]
|
||||
)
|
||||
|
||||
dnl
|
||||
dnl Specify the full file name, with path
|
||||
dnl
|
||||
AC_ARG_WITH([doxygen],
|
||||
AC_HELP_STRING(
|
||||
[--with-doxygen=FILE],
|
||||
[doxygen program to use @<:@default=doxygen@:>@]),
|
||||
dnl
|
||||
dnl Check the given doxygen program.
|
||||
dnl
|
||||
[DOXYGEN=${withval}
|
||||
AC_CHECK_PROG([BUILD_DOCS],
|
||||
[${DOXYGEN}],
|
||||
[yes],
|
||||
[no])
|
||||
if test "x${BUILD_DOCS}" = "xno" ; then
|
||||
echo "WARNING:"
|
||||
echo "The doxygen program you specified:"
|
||||
echo "$DOXYGEN"
|
||||
echo "was not found. Please check the path and make sure "
|
||||
echo "the program exists and is executable."
|
||||
AC_MSG_WARN([Warning: no doxygen detected. Documentation will not be built])
|
||||
fi
|
||||
],
|
||||
[AC_CHECK_PROG([BUILD_DOCS],
|
||||
[${DOXYGEN}],
|
||||
[yes],
|
||||
[no])
|
||||
if test "x${BUILD_DOCS}" = "xno" ; then
|
||||
echo "WARNING:"
|
||||
echo "The doxygen program was not found in your execute"
|
||||
echo "You may have doxygen installed somewhere not covered by your path."
|
||||
echo ""
|
||||
echo "If this is the case make sure you have the packages installed, AND"
|
||||
echo "that the doxygen program is in your execute path (see your"
|
||||
echo "shell manual page on setting the \$PATH environment variable), OR"
|
||||
echo "alternatively, specify the program to use with --with-doxygen."
|
||||
AC_MSG_WARN([Warning: no doxygen detected. Documentation will not be built])
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
dnl
|
||||
dnl Substitution
|
||||
dnl
|
||||
AC_SUBST([DOXYGEN])
|
||||
|
||||
if test "x${BUILD_DOCS}" = "xyes" ; then
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
|
||||
])
|
||||
|
||||
dnl End of doxygen.m4
|
|
@ -2,14 +2,16 @@ SUBDIRS = lib include modules tests
|
|||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
.PHONY: benchmark
|
||||
|
||||
if EINA_ENABLE_BENCH
|
||||
|
||||
bench: all
|
||||
benchmark: all
|
||||
make -C tests eina_bench
|
||||
|
||||
else
|
||||
|
||||
bench:
|
||||
benchmark:
|
||||
@echo "reconfigure with --enable-bench"
|
||||
|
||||
endif
|
||||
|
|
|
@ -21,9 +21,40 @@
|
|||
|
||||
/**
|
||||
* @mainpage Eina
|
||||
* @file Eina.h
|
||||
* @brief Contains list, hash, debugging and tree functions.
|
||||
* TODO add debug functions, magic functions, etc
|
||||
* @author Jorge Luis Zapata Muga
|
||||
* @date 2008
|
||||
*
|
||||
* @section intro_sec Introduction
|
||||
*
|
||||
* The Eina library is a library that implemente an API for data types
|
||||
* in an efficient way. It also provides some useful tools like
|
||||
* opengin shared libraries and errors management.
|
||||
*
|
||||
* This library is cross-platform and can be compiled and used on
|
||||
* Linux and Windows (XP and CE).
|
||||
*
|
||||
* The data types that are available are
|
||||
* @li hash table
|
||||
* @li list
|
||||
* @li string share
|
||||
*
|
||||
* This document describes each data type by providing the algorithms
|
||||
* used in the implementation, the performance, a short tutorial and
|
||||
* the API.
|
||||
*
|
||||
* @section eina_data_types_sec Eina Data Types
|
||||
*
|
||||
* @subsection hashtable Hash Table
|
||||
*
|
||||
* give a small description here : what it is for, what it does
|
||||
* , etc...
|
||||
*
|
||||
* To look at documentation of our hash tables, follow the link @ref
|
||||
* Eina_Hash_Group.
|
||||
*
|
||||
* @todo add debug function
|
||||
* @todo add magic function
|
||||
* @todo add other todo items :)
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
/*============================================================================*
|
||||
* Local *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @cond LOCAL
|
||||
*/
|
||||
|
||||
typedef struct _Eina_Hash_El Eina_Hash_El;
|
||||
typedef struct _Eina_Hash_Foreach Eina_Hash_Foreach;
|
||||
typedef struct _Eina_Iterator_Hash Eina_Iterator_Hash;
|
||||
|
@ -78,12 +83,12 @@ static int _eina_hash_init_count = 0;
|
|||
#undef get16bits
|
||||
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \
|
||||
|| defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
|
||||
#define get16bits(d) (*((const uint16_t *) (d)))
|
||||
# define get16bits(d) (*((const uint16_t *) (d)))
|
||||
#endif
|
||||
|
||||
#if !defined (get16bits)
|
||||
#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
|
||||
+(uint32_t)(((const uint8_t *)(d))[0]) )
|
||||
# define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\
|
||||
+(uint32_t)(((const uint8_t *)(d))[0]) )
|
||||
#endif
|
||||
|
||||
static inline Eina_Hash_El *
|
||||
|
@ -230,12 +235,50 @@ _eina_hash_iterator_free(Eina_Iterator_Hash *it)
|
|||
free(it);
|
||||
}
|
||||
|
||||
/**
|
||||
* @endcond
|
||||
*/
|
||||
|
||||
/*============================================================================*
|
||||
* Global *
|
||||
*============================================================================*/
|
||||
/*============================================================================*
|
||||
* API *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_Hash_Group Hash Functions
|
||||
*
|
||||
* @brief give a small description here : what it is for, what it does
|
||||
* , etc...
|
||||
*
|
||||
* Hash API. Give some hints about the use (functions that must be
|
||||
* used like init / shutdown), general use, etc... Give also a link to
|
||||
* tutorial below.
|
||||
*
|
||||
* @section hashtable_algo Algorithm
|
||||
*
|
||||
* Give here the algorithm used in the implementation
|
||||
*
|
||||
* @section hashtable_perf Performance
|
||||
*
|
||||
* Give some hints about performance if it is possible, and an image !
|
||||
*
|
||||
* @section hashtable_tutorial Tutorial
|
||||
*
|
||||
* Here is a fantastic tutorial about our hash table
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_Hash_Init_Group Hash Init and Shutdown Functions
|
||||
*
|
||||
* Functions that init and shut down hash system.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize the eina hash internal structure.
|
||||
* @return Zero on failure, non-zero on successful initialization.
|
||||
|
@ -264,6 +307,18 @@ eina_hash_shutdown(void)
|
|||
return _eina_hash_init_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_Hash_Creation_Group Hash Creation Functions
|
||||
*
|
||||
* Functions that create hash tables.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
EAPI Eina_Hash *
|
||||
eina_hash_new(Eina_Key_Length key_length_cb,
|
||||
Eina_Key_Cmp key_cmp_cb,
|
||||
|
@ -305,6 +360,70 @@ eina_hash_string_superfast_new(void)
|
|||
EINA_KEY_HASH(eina_hash_superfast));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the number of buckets available in the given hash table.
|
||||
* @param hash The given hash table.
|
||||
* @return @c 256 if @p hash is not @c NULL. @c 0 otherwise.
|
||||
*/
|
||||
EAPI int
|
||||
eina_hash_population(const Eina_Hash *hash)
|
||||
{
|
||||
if (!hash) return 0;
|
||||
return hash->population;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free an entire hash table
|
||||
* @param hash The hash table to be freed
|
||||
*
|
||||
* This function frees up all the memory allocated to storing the specified
|
||||
* hash tale pointed to by @p hash. Any entries in the table that the program
|
||||
* has no more pointers for elsewhere may now be lost, so this should only be
|
||||
* called if the program has lready freed any allocated data in the hash table
|
||||
* or has the pointers for data in teh table stored elswehere as well.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* extern Eina_Hash *hash;
|
||||
*
|
||||
* eina_hash_free(hash);
|
||||
* hash = NULL;
|
||||
* @endcode
|
||||
*/
|
||||
EAPI void
|
||||
eina_hash_free(Eina_Hash *hash)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!hash) return;
|
||||
|
||||
/* FIXME: Should have used an iterator. */
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
while (hash->buckets[i])
|
||||
{
|
||||
Eina_Hash_El *el;
|
||||
|
||||
el = (Eina_Hash_El *)hash->buckets[i];
|
||||
hash->buckets[i] = eina_inlist_remove(hash->buckets[i], el);
|
||||
free(el);
|
||||
}
|
||||
}
|
||||
free(hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_Hash_Data_Group Hash Data Functions
|
||||
*
|
||||
* Functions that add, access or remove data from hashes.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Adds an entry to the given hash table.
|
||||
*
|
||||
|
@ -328,7 +447,6 @@ eina_hash_string_superfast_new(void)
|
|||
* @param data Data to associate with the string given by @p key.
|
||||
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||
* thing goes fine.
|
||||
* @ingroup Eina_Hash_Data
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
eina_hash_add_by_hash(Eina_Hash *hash,
|
||||
|
@ -387,7 +505,6 @@ eina_hash_add_by_hash(Eina_Hash *hash,
|
|||
* @param data Data to associate with the string given by @p key.
|
||||
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||
* thing goes fine.
|
||||
* @ingroup Eina_Hash_Data
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
eina_hash_direct_add_by_hash(Eina_Hash *hash,
|
||||
|
@ -439,7 +556,6 @@ eina_hash_direct_add_by_hash(Eina_Hash *hash,
|
|||
* @param data Data to associate with the string given by @p key.
|
||||
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||
* thing goes fine.
|
||||
* @ingroup Eina_Hash_Data
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
eina_hash_add(Eina_Hash *hash, const void *key, const void *data)
|
||||
|
@ -474,7 +590,6 @@ eina_hash_add(Eina_Hash *hash, const void *key, const void *data)
|
|||
* @param data Data to associate with the string given by @p key.
|
||||
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||
* thing goes fine.
|
||||
* @ingroup Eina_Hash_Data
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
eina_hash_direct_add(Eina_Hash *hash, const void *key, const void *data)
|
||||
|
@ -505,7 +620,6 @@ eina_hash_direct_add(Eina_Hash *hash, const void *key, const void *data)
|
|||
* Otherwise, not required and can be @c NULL.
|
||||
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||
* thing goes fine.
|
||||
* @ingroup Eina_Hash_Data
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
eina_hash_del_by_hash(Eina_Hash *hash, const void *key, int key_length, int key_hash, const void *data)
|
||||
|
@ -540,7 +654,6 @@ eina_hash_del_by_hash(Eina_Hash *hash, const void *key, int key_length, int key_
|
|||
* Otherwise, not required and can be @c NULL.
|
||||
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||
* thing goes fine.
|
||||
* @ingroup Eina_Hash_Data
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
eina_hash_del(Eina_Hash *hash, const void *key, const void *data)
|
||||
|
@ -566,7 +679,6 @@ eina_hash_del(Eina_Hash *hash, const void *key, const void *data)
|
|||
* @param key_hash The hash that always match the key. Ignored if @p key is @c NULL.
|
||||
* @return The data pointer for the stored entry, or @c NULL if not
|
||||
* found.
|
||||
* @ingroup Eina_Hash_Data
|
||||
*/
|
||||
EAPI void *
|
||||
eina_hash_find_by_hash(const Eina_Hash *hash, const void *key, int key_length, int key_hash)
|
||||
|
@ -590,7 +702,6 @@ eina_hash_find_by_hash(const Eina_Hash *hash, const void *key, int key_length, i
|
|||
* @param key The key of the entry to find.
|
||||
* @return The data pointer for the stored entry, or @c NULL if not
|
||||
* found.
|
||||
* @ingroup Eina_Hash_Data
|
||||
*/
|
||||
EAPI void *
|
||||
eina_hash_find(const Eina_Hash *hash, const void *key)
|
||||
|
@ -616,7 +727,6 @@ eina_hash_find(const Eina_Hash *hash, const void *key)
|
|||
* @return The data pointer for the old stored entry, or @c NULL if not
|
||||
* found. If an existing entry is not found, nothing is added to the
|
||||
* hash.
|
||||
* @ingroup Eina_Hash_Data
|
||||
*/
|
||||
EAPI void *
|
||||
eina_hash_modify_by_hash(Eina_Hash *hash, const void *key, int key_length, int key_hash, const void *data)
|
||||
|
@ -645,7 +755,6 @@ eina_hash_modify_by_hash(Eina_Hash *hash, const void *key, int key_length, int k
|
|||
* @return The data pointer for the old stored entry, or @c NULL if not
|
||||
* found. If an existing entry is not found, nothing is added to the
|
||||
* hash.
|
||||
* @ingroup Eina_Hash_Data
|
||||
*/
|
||||
EAPI void *
|
||||
eina_hash_modify(Eina_Hash *hash, const void *key, const void *data)
|
||||
|
@ -662,68 +771,21 @@ eina_hash_modify(Eina_Hash *hash, const void *key, const void *data)
|
|||
}
|
||||
|
||||
/**
|
||||
* @defgroup Eina_Hash_General_Group Hash General Functions
|
||||
*
|
||||
* Miscellaneous functions that operate on hash objects.
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieves the number of buckets available in the given hash table.
|
||||
* @param hash The given hash table.
|
||||
* @return @c 256 if @p hash is not @c NULL. @c 0 otherwise.
|
||||
* @ingroup Eina_Hash_General_Group
|
||||
*/
|
||||
EAPI int
|
||||
eina_hash_population(const Eina_Hash *hash)
|
||||
{
|
||||
if (!hash) return 0;
|
||||
return hash->population;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free an entire hash table
|
||||
* @param hash The hash table to be freed
|
||||
*
|
||||
* This function frees up all the memory allocated to storing the specified
|
||||
* hash tale pointed to by @p hash. Any entries in the table that the program
|
||||
* has no more pointers for elsewhere may now be lost, so this should only be
|
||||
* called if the program has lready freed any allocated data in the hash table
|
||||
* or has the pointers for data in teh table stored elswehere as well.
|
||||
*
|
||||
* Example:
|
||||
* @code
|
||||
* extern Eina_Hash *hash;
|
||||
*
|
||||
* eina_hash_free(hash);
|
||||
* hash = NULL;
|
||||
* @endcode
|
||||
* @ingroup Eina_Hash_General_Group
|
||||
*/
|
||||
EAPI void
|
||||
eina_hash_free(Eina_Hash *hash)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!hash) return;
|
||||
|
||||
/* FIXME: Should have used an iterator. */
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
while (hash->buckets[i])
|
||||
{
|
||||
Eina_Hash_El *el;
|
||||
|
||||
el = (Eina_Hash_El *)hash->buckets[i];
|
||||
hash->buckets[i] = eina_inlist_remove(hash->buckets[i], el);
|
||||
free(el);
|
||||
}
|
||||
}
|
||||
free(hash);
|
||||
}
|
||||
|
||||
/*============================================================================*
|
||||
* Iterator *
|
||||
*============================================================================*/
|
||||
|
||||
/**
|
||||
* @addtogroup Eina_Hash_Iterator_Group Hash Iterator Functions
|
||||
*
|
||||
* Functions that iterate over hash tables.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Call a function on every member stored in the hash table
|
||||
* @param hash The hash table whose members will be walked
|
||||
|
@ -755,7 +817,6 @@ eina_hash_free(Eina_Hash *hash)
|
|||
* free(hash_fn_data);
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup Eina_Hash_General_Group
|
||||
*/
|
||||
EAPI void
|
||||
eina_hash_foreach(const Eina_Hash *hash,
|
||||
|
@ -836,6 +897,10 @@ eina_hash_iterator_tuple_new(const Eina_Hash *hash)
|
|||
return &it->iterator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* Common hash functions */
|
||||
|
||||
/* Paul Hsieh (http://www.azillionmonkeys.com/qed/hash.html)
|
||||
|
@ -890,3 +955,6 @@ eina_hash_superfast(const char *key, int len)
|
|||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue