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
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
SUBDIRS = src
|
SUBDIRS = src doc
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = \
|
MAINTAINERCLEANFILES = \
|
||||||
Makefile.in \
|
Makefile.in \
|
||||||
|
@ -33,6 +33,14 @@ eina.pc
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = eina.pc
|
pkgconfig_DATA = eina.pc
|
||||||
|
|
||||||
|
.PHONY: doc coverage benchmark
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
|
||||||
|
doc:
|
||||||
|
@echo "entering doc/"
|
||||||
|
make -C doc doc
|
||||||
|
|
||||||
# Unit tests
|
# Unit tests
|
||||||
|
|
||||||
if EINA_ENABLE_TESTS
|
if EINA_ENABLE_TESTS
|
||||||
|
@ -85,12 +93,12 @@ endif
|
||||||
if EINA_ENABLE_BENCH
|
if EINA_ENABLE_BENCH
|
||||||
|
|
||||||
benchmark:
|
benchmark:
|
||||||
@make -C src bench
|
@make -C src benchmark
|
||||||
@mkdir result || true
|
@mkdir result || true
|
||||||
@cd result && ../src/tests/eina_bench `date +%F_%T`
|
@cd result && ../src/tests/eina_bench `date +%F_%T`
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
bench:
|
benchmark:
|
||||||
@echo "reconfigure with --enable-bench"
|
@echo "reconfigure with --enable-bench"
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -108,15 +108,18 @@ if test "x${enable_tests}" = "xyes" ; then
|
||||||
[enable_tests="no"]
|
[enable_tests="no"]
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL(EINA_ENABLE_TESTS, test "x${enable_tests}" = "xyes")
|
AM_CONDITIONAL(EINA_ENABLE_TESTS, test "x${enable_tests}" = "xyes")
|
||||||
|
|
||||||
# Check ememoa memory pool library
|
# Check ememoa memory pool library
|
||||||
|
|
||||||
|
if test "x${enable_ememoa}" = "xyes" ; then
|
||||||
PKG_CHECK_MODULES([EMEMOA],
|
PKG_CHECK_MODULES([EMEMOA],
|
||||||
[ememoa >= 0.0.26 ],
|
[ememoa >= 0.0.26 ],
|
||||||
[enable_ememoa="yes"],
|
[enable_ememoa="yes"],
|
||||||
[enable_ememoa="no"]
|
[enable_ememoa="no"]
|
||||||
)
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL(EINA_ENABLE_EMEMOA, test "x${enable_ememoa}" = "xyes")
|
AM_CONDITIONAL(EINA_ENABLE_EMEMOA, test "x${enable_ememoa}" = "xyes")
|
||||||
|
|
||||||
|
@ -153,6 +156,11 @@ AC_SUBST(COVERAGE_LIBS)
|
||||||
|
|
||||||
AM_CONDITIONAL(EINA_ENABLE_COVERAGE, test "x${enable_coverage}" = "xyes")
|
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
|
### Checks for types
|
||||||
|
|
||||||
|
@ -193,6 +201,7 @@ AC_SUBST(lt_enable_auto_import)
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
eina.pc
|
eina.pc
|
||||||
|
doc/Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/include/Makefile
|
src/include/Makefile
|
||||||
src/lib/Makefile
|
src/lib/Makefile
|
||||||
|
@ -220,6 +229,7 @@ echo
|
||||||
echo
|
echo
|
||||||
echo "Configuration Options Summary:"
|
echo "Configuration Options Summary:"
|
||||||
echo
|
echo
|
||||||
|
echo " Documentation........: ${build_doc}"
|
||||||
echo " Tests................: ${enable_tests}"
|
echo " Tests................: ${enable_tests}"
|
||||||
echo " Coverage.............: ${enable_coverage}"
|
echo " Coverage.............: ${enable_coverage}"
|
||||||
echo " Bench................: ${enable_bench}"
|
echo " Bench................: ${enable_bench}"
|
||||||
|
|
|
@ -38,7 +38,7 @@ PROJECT_NUMBER =
|
||||||
# If a relative path is entered, it will be relative to the location
|
# 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.
|
# 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
|
# 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
|
# 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
|
# directories like "/usr/src/myproject". Separate the files or directories
|
||||||
# with spaces.
|
# with spaces.
|
||||||
|
|
||||||
INPUT = ./src/lib
|
INPUT = ../src/
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# 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
|
# 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
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
|
.PHONY: benchmark
|
||||||
|
|
||||||
if EINA_ENABLE_BENCH
|
if EINA_ENABLE_BENCH
|
||||||
|
|
||||||
bench: all
|
benchmark: all
|
||||||
make -C tests eina_bench
|
make -C tests eina_bench
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
bench:
|
benchmark:
|
||||||
@echo "reconfigure with --enable-bench"
|
@echo "reconfigure with --enable-bench"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -21,9 +21,40 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @mainpage Eina
|
* @mainpage Eina
|
||||||
* @file Eina.h
|
* @author Jorge Luis Zapata Muga
|
||||||
* @brief Contains list, hash, debugging and tree functions.
|
* @date 2008
|
||||||
* TODO add debug functions, magic functions, etc
|
*
|
||||||
|
* @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>
|
#include <stdint.h>
|
||||||
|
|
|
@ -31,6 +31,11 @@
|
||||||
/*============================================================================*
|
/*============================================================================*
|
||||||
* Local *
|
* Local *
|
||||||
*============================================================================*/
|
*============================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @cond LOCAL
|
||||||
|
*/
|
||||||
|
|
||||||
typedef struct _Eina_Hash_El Eina_Hash_El;
|
typedef struct _Eina_Hash_El Eina_Hash_El;
|
||||||
typedef struct _Eina_Hash_Foreach Eina_Hash_Foreach;
|
typedef struct _Eina_Hash_Foreach Eina_Hash_Foreach;
|
||||||
typedef struct _Eina_Iterator_Hash Eina_Iterator_Hash;
|
typedef struct _Eina_Iterator_Hash Eina_Iterator_Hash;
|
||||||
|
@ -230,12 +235,50 @@ _eina_hash_iterator_free(Eina_Iterator_Hash *it)
|
||||||
free(it);
|
free(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @endcond
|
||||||
|
*/
|
||||||
|
|
||||||
/*============================================================================*
|
/*============================================================================*
|
||||||
* Global *
|
* Global *
|
||||||
*============================================================================*/
|
*============================================================================*/
|
||||||
/*============================================================================*
|
/*============================================================================*
|
||||||
* API *
|
* 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.
|
* Initialize the eina hash internal structure.
|
||||||
* @return Zero on failure, non-zero on successful initialization.
|
* @return Zero on failure, non-zero on successful initialization.
|
||||||
|
@ -264,6 +307,18 @@ eina_hash_shutdown(void)
|
||||||
return _eina_hash_init_count;
|
return _eina_hash_init_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup Eina_Hash_Creation_Group Hash Creation Functions
|
||||||
|
*
|
||||||
|
* Functions that create hash tables.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
EAPI Eina_Hash *
|
EAPI Eina_Hash *
|
||||||
eina_hash_new(Eina_Key_Length key_length_cb,
|
eina_hash_new(Eina_Key_Length key_length_cb,
|
||||||
Eina_Key_Cmp key_cmp_cb,
|
Eina_Key_Cmp key_cmp_cb,
|
||||||
|
@ -305,6 +360,70 @@ eina_hash_string_superfast_new(void)
|
||||||
EINA_KEY_HASH(eina_hash_superfast));
|
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.
|
* 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.
|
* @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
|
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||||
* thing goes fine.
|
* thing goes fine.
|
||||||
* @ingroup Eina_Hash_Data
|
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eina_hash_add_by_hash(Eina_Hash *hash,
|
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.
|
* @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
|
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||||
* thing goes fine.
|
* thing goes fine.
|
||||||
* @ingroup Eina_Hash_Data
|
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eina_hash_direct_add_by_hash(Eina_Hash *hash,
|
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.
|
* @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
|
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||||
* thing goes fine.
|
* thing goes fine.
|
||||||
* @ingroup Eina_Hash_Data
|
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eina_hash_add(Eina_Hash *hash, const void *key, const void *data)
|
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.
|
* @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
|
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||||
* thing goes fine.
|
* thing goes fine.
|
||||||
* @ingroup Eina_Hash_Data
|
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eina_hash_direct_add(Eina_Hash *hash, const void *key, const void *data)
|
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.
|
* Otherwise, not required and can be @c NULL.
|
||||||
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||||
* thing goes fine.
|
* thing goes fine.
|
||||||
* @ingroup Eina_Hash_Data
|
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eina_hash_del_by_hash(Eina_Hash *hash, const void *key, int key_length, int key_hash, const void *data)
|
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.
|
* Otherwise, not required and can be @c NULL.
|
||||||
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
* @return Will return EINA_FALSE if an error occured, and EINA_TRUE if every
|
||||||
* thing goes fine.
|
* thing goes fine.
|
||||||
* @ingroup Eina_Hash_Data
|
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
eina_hash_del(Eina_Hash *hash, const void *key, const void *data)
|
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.
|
* @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
|
* @return The data pointer for the stored entry, or @c NULL if not
|
||||||
* found.
|
* found.
|
||||||
* @ingroup Eina_Hash_Data
|
|
||||||
*/
|
*/
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eina_hash_find_by_hash(const Eina_Hash *hash, const void *key, int key_length, int key_hash)
|
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.
|
* @param key The key of the entry to find.
|
||||||
* @return The data pointer for the stored entry, or @c NULL if not
|
* @return The data pointer for the stored entry, or @c NULL if not
|
||||||
* found.
|
* found.
|
||||||
* @ingroup Eina_Hash_Data
|
|
||||||
*/
|
*/
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eina_hash_find(const Eina_Hash *hash, const void *key)
|
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
|
* @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
|
* found. If an existing entry is not found, nothing is added to the
|
||||||
* hash.
|
* hash.
|
||||||
* @ingroup Eina_Hash_Data
|
|
||||||
*/
|
*/
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eina_hash_modify_by_hash(Eina_Hash *hash, const void *key, int key_length, int key_hash, const void *data)
|
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
|
* @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
|
* found. If an existing entry is not found, nothing is added to the
|
||||||
* hash.
|
* hash.
|
||||||
* @ingroup Eina_Hash_Data
|
|
||||||
*/
|
*/
|
||||||
EAPI void *
|
EAPI void *
|
||||||
eina_hash_modify(Eina_Hash *hash, const void *key, const void *data)
|
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 *
|
* 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
|
* Call a function on every member stored in the hash table
|
||||||
* @param hash The hash table whose members will be walked
|
* @param hash The hash table whose members will be walked
|
||||||
|
@ -755,7 +817,6 @@ eina_hash_free(Eina_Hash *hash)
|
||||||
* free(hash_fn_data);
|
* free(hash_fn_data);
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
* @ingroup Eina_Hash_General_Group
|
|
||||||
*/
|
*/
|
||||||
EAPI void
|
EAPI void
|
||||||
eina_hash_foreach(const Eina_Hash *hash,
|
eina_hash_foreach(const Eina_Hash *hash,
|
||||||
|
@ -836,6 +897,10 @@ eina_hash_iterator_tuple_new(const Eina_Hash *hash)
|
||||||
return &it->iterator;
|
return &it->iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
/* Common hash functions */
|
/* Common hash functions */
|
||||||
|
|
||||||
/* Paul Hsieh (http://www.azillionmonkeys.com/qed/hash.html)
|
/* Paul Hsieh (http://www.azillionmonkeys.com/qed/hash.html)
|
||||||
|
@ -890,3 +955,6 @@ eina_hash_superfast(const char *key, int len)
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
Loading…
Reference in New Issue