Eina.h | Eina.h | |||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
/** | /** | |||
* @file | * @file | |||
* @brief Eina Utility library | * @brief Eina Utility library | |||
* | * | |||
* These routines are used for Eina. | * These routines are used for Eina. | |||
*/ | */ | |||
/** | /** | |||
* @mainpage Eina | * @mainpage Eina | |||
* | * | |||
* @version 1.1 | * @version 1.7 | |||
* @date 2008-2012 | * @date 2008-2012 | |||
* | * | |||
* @section eina_intro_sec Introduction | * @section eina_intro_sec Introduction | |||
* | * | |||
* The Eina library is a library that implements an API for data types | * The Eina library is a library that implements an API for data types | |||
* in an efficient way. It also provides some useful tools like | * in an efficient way. It also provides some useful tools like | |||
* opening shared libraries, errors management, type conversion, | * opening shared libraries, errors management, type conversion, | |||
* time accounting and memory pool. | * time accounting and memory pool. | |||
* | * | |||
* This library is cross-platform and can be compiled and used on | * This library is cross-platform and can be compiled and used on | |||
skipping to change at line 103 | skipping to change at line 103 | |||
* | * | |||
* Please see the @ref authors page for contact details. | * Please see the @ref authors page for contact details. | |||
* | * | |||
* @defgroup Eina_Data_Types_Group Data Types | * @defgroup Eina_Data_Types_Group Data Types | |||
* | * | |||
* Eina provide easy to use and optimized data types and structures. | * Eina provide easy to use and optimized data types and structures. | |||
* | * | |||
* | * | |||
* @defgroup Eina_Containers_Group Containers | * @defgroup Eina_Containers_Group Containers | |||
* | * | |||
* @section Intro Introduction | ||||
* Containers are data types that hold data and allow iteration over | * Containers are data types that hold data and allow iteration over | |||
* their elements with an @ref Eina_Iterator_Group, or eventually an | * their elements with an @ref Eina_Iterator_Group, or eventually an | |||
* @ref Eina_Accessor_Group. | * @ref Eina_Accessor_Group. | |||
* | * | |||
* The containers in eina are designed with performance in mind, one conseq uence | * The containers in eina are designed with performance in mind, one conseq uence | |||
* of this is that they @b don't check the validity of data structures give n to | * of this is that they @b don't check the validity of data structures give n to | |||
* them(@ref Eina_Magic_Group). | * them(@ref Eina_Magic_Group). | |||
* | * | |||
* @section Choice Choosing container type | ||||
* | ||||
* The choice of which container to use in each situation is very important in | * The choice of which container to use in each situation is very important in | |||
* achieving good performance and readable code. The most common container types | * achieving good performance and readable code. The most common container types | |||
* to be used are: | * to be used are: | |||
* @li List | * @li List | |||
* @li Inline list | * @li Inline list | |||
* @li Array | * @li Array | |||
* @li Inline array | * @li Inline array | |||
* @li Hash | * @li Hash | |||
* | * | |||
* All types have virtues and vices. The following considerations are good | * All types have virtues and vices. The following considerations are good | |||
skipping to change at line 133 | skipping to change at line 136 | |||
* @li arrays are good when accessing members by position; | * @li arrays are good when accessing members by position; | |||
* @li lists provide good versatility for adding elements in any position w ith | * @li lists provide good versatility for adding elements in any position w ith | |||
* minimal overhead; | * minimal overhead; | |||
* @li inline arrays use very little memory and don't cause fragmentation a nd | * @li inline arrays use very little memory and don't cause fragmentation a nd | |||
* therefore are a good option in memory constrained systems; | * therefore are a good option in memory constrained systems; | |||
* @li inline lists are the appropriate type to use when the flexibility of a | * @li inline lists are the appropriate type to use when the flexibility of a | |||
* list is required but the overhead of pointer indirection is not acceptab le. | * list is required but the overhead of pointer indirection is not acceptab le. | |||
* @warning These are general considerations, every situation is different, | * @warning These are general considerations, every situation is different, | |||
* don't follow these recommendations blindly. | * don't follow these recommendations blindly. | |||
* | * | |||
* @section Creation Creating custom container types | ||||
* | ||||
* @note Before creating a custom container check if one of the existing on | ||||
es | ||||
* doesn't suit your needs. For example, while there is no stack type @ref | ||||
* Eina_Array_Group is a very good substitute, similarly there is no queue | ||||
type | ||||
* however an @ref Eina_List_Group works very well as a queue. | ||||
* | ||||
* If creating a custom container type consider allowing access to the data | ||||
in | ||||
* your container through @ref Eina_Iterator_Group "Iterators" and @ref | ||||
* Eina_Accessor_Group "Accessors". To do so your container should have an | ||||
* iterator creation function and an accessor creation function, these func | ||||
tions | ||||
* should return properly populated @ref _Eina_Iterator and @ref _Eina_Acce | ||||
ssor. | ||||
* | ||||
* @defgroup Eina_Tools_Group Tools | * @defgroup Eina_Tools_Group Tools | |||
* | * | |||
* Eina tools aims to help application development, providing ways to | * Eina tools aims to help application development, providing ways to | |||
* make it safer, log errors, manage memory more efficiently and more. | * make it safer, log errors, manage memory more efficiently and more. | |||
* | * | |||
*/ | */ | |||
/** | /** | |||
* | * | |||
* @page authors Authors | * @page authors Authors | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 22 lines changed or added | |||
eina_accessor.h | eina_accessor.h | |||
---|---|---|---|---|
skipping to change at line 89 | skipping to change at line 89 | |||
* @addtogroup Eina_Accessor_Group Accessor Functions | * @addtogroup Eina_Accessor_Group Accessor Functions | |||
* | * | |||
* @brief These functions manage accessor on containers. | * @brief These functions manage accessor on containers. | |||
* | * | |||
* These functions allow to access elements of a container in a | * These functions allow to access elements of a container in a | |||
* generic way, without knowing which container is used (a bit like | * generic way, without knowing which container is used (a bit like | |||
* iterators in the C++ STL). Accessors allows random access (that is, any | * iterators in the C++ STL). Accessors allows random access (that is, any | |||
* element in the container). For sequential access, see | * element in the container). For sequential access, see | |||
* @ref Eina_Iterator_Group. | * @ref Eina_Iterator_Group. | |||
* | * | |||
* An accessor is created from container data types, so no creation | * Getting an accessor to access elements of a given container is done thro | |||
* function is available here. An accessor is deleted with | ugh | |||
* eina_accessor_free(). To get the data of an element at a given | * the functions of that particular container. There is no function to crea | |||
te | ||||
* a generic accessor as accessors absolutely depend on the container. This | ||||
* means you won't find accessor creation function here, those can be found | ||||
on | ||||
* the documentation of the container type you're using. Though created wit | ||||
h | ||||
* container specific functions accessors are always deleted with the same | ||||
* function: eina_accessor_free(). | ||||
* | ||||
* To get the data of an element at a given | ||||
* position, use eina_accessor_data_get(). To call a function on | * position, use eina_accessor_data_get(). To call a function on | |||
* chosen elements of a container, use eina_accessor_over(). | * chosen elements of a container, use eina_accessor_over(). | |||
* | * | |||
* See an example @ref eina_accessor_example_01_page "here". | * See an example @ref eina_accessor_example_01_page "here". | |||
*/ | */ | |||
/** | /** | |||
* @addtogroup Eina_Content_Access_Group Content Access | * @addtogroup Eina_Content_Access_Group Content Access | |||
* | * | |||
* @{ | * @{ | |||
skipping to change at line 145 | skipping to change at line 151 | |||
/** | /** | |||
* @typedef Eina_Accessor_Lock_Callback | * @typedef Eina_Accessor_Lock_Callback | |||
* Type for a callback that lock the container. | * Type for a callback that lock the container. | |||
*/ | */ | |||
typedef Eina_Bool (*Eina_Accessor_Lock_Callback)(Eina_Accessor *it); | typedef Eina_Bool (*Eina_Accessor_Lock_Callback)(Eina_Accessor *it); | |||
/** | /** | |||
* @struct _Eina_Accessor | * @struct _Eina_Accessor | |||
* Type to provide random access to data structures. | * Type to provide random access to data structures. | |||
* | ||||
* If creating an accessor remember to set the type using @ref EINA_MAGIC_S | ||||
ET. | ||||
*/ | */ | |||
struct _Eina_Accessor | struct _Eina_Accessor | |||
{ | { | |||
#define EINA_ACCESSOR_VERSION 1 | #define EINA_ACCESSOR_VERSION 1 | |||
int version; /**< Version of the Access or API. */ | int version; /**< Version of the Access or API. */ | |||
Eina_Accessor_Get_At_Callback get_at EINA_ARG_NONNULL(1, 3 ) EINA_WARN_UNUSED_RESULT; /**< Callback called when a data element is requ ested. */ | Eina_Accessor_Get_At_Callback get_at EINA_ARG_NONNULL(1, 3 ) EINA_WARN_UNUSED_RESULT; /**< Callback called when a data element is requ ested. */ | |||
Eina_Accessor_Get_Container_Callback get_container EINA_ARG_NONNULL(1) E INA_WARN_UNUSED_RESULT; /**< Callback called when the container is requeste d. */ | Eina_Accessor_Get_Container_Callback get_container EINA_ARG_NONNULL(1) E INA_WARN_UNUSED_RESULT; /**< Callback called when the container is requeste d. */ | |||
Eina_Accessor_Free_Callback free EINA_ARG_NONNULL(1); /**< Callback called when the container is freed. */ | Eina_Accessor_Free_Callback free EINA_ARG_NONNULL(1); /**< Callback called when the container is freed. */ | |||
skipping to change at line 193 | skipping to change at line 201 | |||
*/ | */ | |||
#define FUNC_ACCESSOR_LOCK(Function) ((Eina_Accessor_Lock_Callback )Function) | #define FUNC_ACCESSOR_LOCK(Function) ((Eina_Accessor_Lock_Callback )Function) | |||
/** | /** | |||
* @brief Free an accessor. | * @brief Free an accessor. | |||
* | * | |||
* @param accessor The accessor to free. | * @param accessor The accessor to free. | |||
* | * | |||
* This function frees @p accessor if it is not @c NULL; | * This function frees @p accessor if it is not @c NULL; | |||
*/ | */ | |||
EAPI void eina_accessor_free(Eina_Accessor *accessor) EINA_ARG_NONNULL (1); | EAPI void eina_accessor_free(Eina_Accessor *accessor); | |||
/** | /** | |||
* @brief Retrieve the data of an accessor at a given position. | * @brief Retrieve the data of an accessor at a given position. | |||
* | * | |||
* @param accessor The accessor. | * @param accessor The accessor. | |||
* @param position The position of the element. | * @param position The position of the element. | |||
* @param data The pointer that stores the data to retrieve. | * @param data The pointer that stores the data to retrieve. | |||
* @return #EINA_TRUE on success, #EINA_FALSE otherwise. | * @return #EINA_TRUE on success, #EINA_FALSE otherwise. | |||
* | * | |||
* This function retrieves the data of the element pointed by | * This function retrieves the data of the element pointed by | |||
skipping to change at line 243 | skipping to change at line 251 | |||
* starting from the element at position @p start and ending to the | * starting from the element at position @p start and ending to the | |||
* element at position @p end. For Each element, the callback | * element at position @p end. For Each element, the callback | |||
* @p cb is called with the data @p fdata. If @p accessor is @c NULL | * @p cb is called with the data @p fdata. If @p accessor is @c NULL | |||
* or if @p start is greter or equal than @p end, the function returns | * or if @p start is greter or equal than @p end, the function returns | |||
* immediately. | * immediately. | |||
*/ | */ | |||
EAPI void eina_accessor_over(Eina_Accessor *accessor, | EAPI void eina_accessor_over(Eina_Accessor *accessor, | |||
Eina_Each_Cb cb, | Eina_Each_Cb cb, | |||
unsigned int start, | unsigned int start, | |||
unsigned int end, | unsigned int end, | |||
const void *fdata) EINA_ARG_NONNULL(1, 2); | const void *fdata) EINA_ARG_NONNULL(2); | |||
/** | /** | |||
* @brief Lock the container of the accessor. | * @brief Lock the container of the accessor. | |||
* | * | |||
* @param accessor The accessor. | * @param accessor The accessor. | |||
* @return #EINA_TRUE on success, #EINA_FALSE otherwise. | * @return #EINA_TRUE on success, #EINA_FALSE otherwise. | |||
* | * | |||
* If the container of the @p accessor permits it, it will be locked. When a | * If the container of the @p accessor permits it, it will be locked. When a | |||
* container is locked calling eina_accessor_over() on it will return | * container is locked calling eina_accessor_over() on it will return | |||
* immediately. If @p accessor is @c NULL or if a problem occurred, #EINA_F ALSE | * immediately. If @p accessor is @c NULL or if a problem occurred, #EINA_F ALSE | |||
skipping to change at line 322 | skipping to change at line 330 | |||
* to use iterators to iterate over, as they're likely to be more | * to use iterators to iterate over, as they're likely to be more | |||
* optimized for such task. | * optimized for such task. | |||
* | * | |||
* @note this example is not optimal algorithm to release a list since | * @note this example is not optimal algorithm to release a list since | |||
* it will walk the list twice, but it serves as an example. For | * it will walk the list twice, but it serves as an example. For | |||
* optimized version use EINA_LIST_FREE() | * optimized version use EINA_LIST_FREE() | |||
* | * | |||
* @warning unless explicitly stated in functions returning accessors, | * @warning unless explicitly stated in functions returning accessors, | |||
* do not modify the accessed object while you walk it, in this | * do not modify the accessed object while you walk it, in this | |||
* example using lists, do not remove list nodes or you might | * example using lists, do not remove list nodes or you might | |||
* crash! This is not a limitiation of accessors themselves, | * crash! This is not a limitation of accessors themselves, | |||
* rather in the accessors implementations to keep them as simple | * rather in the accessors implementations to keep them as simple | |||
* and fast as possible. | * and fast as possible. | |||
*/ | */ | |||
#define EINA_ACCESSOR_FOREACH(accessor, counter, data) \ | #define EINA_ACCESSOR_FOREACH(accessor, counter, data) \ | |||
for ((counter) = 0; \ | for ((counter) = 0; \ | |||
eina_accessor_data_get((accessor), (counter), (void **)(void *)&(dat a)); \ | eina_accessor_data_get((accessor), (counter), (void **)(void *)&(dat a)); \ | |||
(counter)++) | (counter)++) | |||
/** | /** | |||
* @} | * @} | |||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 19 lines changed or added | |||
eina_array.h | eina_array.h | |||
---|---|---|---|---|
skipping to change at line 71 | skipping to change at line 71 | |||
* Now let us populate our array with some strings: | * Now let us populate our array with some strings: | |||
* @until push | * @until push | |||
* @note Notice we use strdup, so we will have to free that memory later on . | * @note Notice we use strdup, so we will have to free that memory later on . | |||
* | * | |||
* Now lets check the size of the array: | * Now lets check the size of the array: | |||
* @until printf | * @until printf | |||
* | * | |||
* And now we call a function on every member of our array to print it: | * And now we call a function on every member of our array to print it: | |||
* @until foreach | * @until foreach | |||
* | * | |||
* One of the strenghts of @ref Eina_Array over @ref Eina_List is that it h as | * One of the strengths of @ref Eina_Array over @ref Eina_List is that it h as | |||
* very fast random access to elements, so this is very efficient: | * very fast random access to elements, so this is very efficient: | |||
* @until printf | * @until printf | |||
* | * | |||
* And now we free up the memory allocated with the strdup()s: | * And now we free up the memory allocated with the strdup()s: | |||
* @until free | * @until free | |||
* | * | |||
* And the array memory itself: | * And the array memory itself: | |||
* @until array_free | * @until array_free | |||
* | * | |||
* And finally shutdown eina and exit: | * And finally shutdown eina and exit: | |||
skipping to change at line 340 | skipping to change at line 340 | |||
void *gdata) EINA_ARG_NONNULL(1, 2); | void *gdata) EINA_ARG_NONNULL(1, 2); | |||
static inline Eina_Bool eina_array_push(Eina_Array *array, | static inline Eina_Bool eina_array_push(Eina_Array *array, | |||
const void *data) EINA_ARG_NONNULL( 1, 2); | const void *data) EINA_ARG_NONNULL( 1, 2); | |||
static inline void *eina_array_pop(Eina_Array *array) EINA_ARG_NONNULL( 1); | static inline void *eina_array_pop(Eina_Array *array) EINA_ARG_NONNULL( 1); | |||
static inline void *eina_array_data_get(const Eina_Array *array, | static inline void *eina_array_data_get(const Eina_Array *array, | |||
unsigned int idx) EINA_ARG _NONNULL(1); | unsigned int idx) EINA_ARG _NONNULL(1); | |||
/** | /** | |||
* @brief Set the data at a given position in an array. | * @brief Set the data at a given position in an array. | |||
* | * | |||
* @param array The array. | * @param array The array. | |||
* @param idx The potition of the data to set. | * @param idx The position of the data to set. | |||
* @param data The data to set. | * @param data The data to set. | |||
* | * | |||
* This function sets the data at the position @p idx in @p | * This function sets the data at the position @p idx in @p | |||
* array to @p data, this effectively replaces the previously held data, yo u | * array to @p data, this effectively replaces the previously held data, yo u | |||
* must therefore get a pointer to it first if you need to free it. For | * must therefore get a pointer to it first if you need to free it. For | |||
* performance reasons, there is no check of @p array or @p idx. If it is @ c | * performance reasons, there is no check of @p array or @p idx. If it is @ c | |||
* NULL or invalid, the program may crash. | * NULL or invalid, the program may crash. | |||
*/ | */ | |||
static inline void eina_array_data_set(const Eina_Array *array, | static inline void eina_array_data_set(const Eina_Array *array, | |||
unsigned int idx, | unsigned int idx, | |||
skipping to change at line 402 | skipping to change at line 402 | |||
* by returning #EINA_FALSE it will stop and return #EINA_FALSE as a result . | * by returning #EINA_FALSE it will stop and return #EINA_FALSE as a result . | |||
*/ | */ | |||
static inline Eina_Bool eina_array_foreach(Eina_Array *array, | static inline Eina_Bool eina_array_foreach(Eina_Array *array, | |||
Eina_Each_Cb cb, | Eina_Each_Cb cb, | |||
void *fdata); | void *fdata); | |||
/** | /** | |||
* @def EINA_ARRAY_ITER_NEXT | * @def EINA_ARRAY_ITER_NEXT | |||
* @brief Macro to iterate over an array easily. | * @brief Macro to iterate over an array easily. | |||
* | * | |||
* @param array The array to iterate over. | * @param array The array to iterate over. | |||
* @param index The integer number that is increased while itareting. | * @param index The integer number that is increased while iterating. | |||
* @param item The data | * @param item The data | |||
* @param iterator The iterator | * @param iterator The iterator | |||
* | * | |||
* This macro allows the iteration over @p array in an easy way. It | * This macro allows the iteration over @p array in an easy way. It | |||
* iterates from the first element to the last one. @p index is an | * iterates from the first element to the last one. @p index is an | |||
* integer that increases from 0 to the number of elements. @p item is | * integer that increases from 0 to the number of elements. @p item is | |||
* the data of each element of @p array, so it is a pointer to a type | * the data of each element of @p array, so it is a pointer to a type | |||
* chosen by the user. @p iterator is of type #Eina_Array_Iterator. | * chosen by the user. @p iterator is of type #Eina_Array_Iterator. | |||
* | * | |||
* This macro can be used for freeing the data of an array, like in | * This macro can be used for freeing the data of an array, like in | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added | |||
eina_benchmark.h | eina_benchmark.h | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
* The Benchmark module allows you to write easily benchmarks | * The Benchmark module allows you to write easily benchmarks | |||
* framework in a project for timing critical part and detect slow | * framework in a project for timing critical part and detect slow | |||
* parts of code. In addition it automatically creates data files of | * parts of code. In addition it automatically creates data files of | |||
* these benchmark, as well as a gnuplot file which can display the | * these benchmark, as well as a gnuplot file which can display the | |||
* comparison curves of the benchmarks. | * comparison curves of the benchmarks. | |||
* | * | |||
* @section tutorial_benchmark_basic_usage Basic Usage | * @section tutorial_benchmark_basic_usage Basic Usage | |||
* | * | |||
* To create a basic benchmark, you have to follow these steps: | * To create a basic benchmark, you have to follow these steps: | |||
* | * | |||
* @li Create a new bechmark | * @li Create a new benchmark | |||
* @li Write the functions that wraps the the functions you want to | * @li Write the functions that wraps the functions you want to | |||
* bechmark. | * benchmark. | |||
* @li Register these wrappers functions. | * @li Register these wrappers functions. | |||
* @li Run the benchmark. | * @li Run the benchmark. | |||
* @li Free the memory. | * @li Free the memory. | |||
* | * | |||
* Here is a basic example of bechmark which creates two functions | * Here is a basic example of benchmark which creates two functions | |||
* that will be run. These functions just print a message. | * that will be run. These functions just print a message. | |||
* | * | |||
* @code | * @code | |||
* #include <stdlib.h> | * #include <stdlib.h> | |||
* #include <stdio.h> | * #include <stdio.h> | |||
* | * | |||
* #include <Eina.h> | * #include <Eina.h> | |||
* | * | |||
* static | * static | |||
* void work1(int request) | * void work1(int request) | |||
skipping to change at line 402 | skipping to change at line 402 | |||
* @param count_step The step data to be passed to @p bench_cb. | * @param count_step The step data to be passed to @p bench_cb. | |||
* @return #EINA_FALSE on failure, #EINA_TRUE otherwise. | * @return #EINA_FALSE on failure, #EINA_TRUE otherwise. | |||
* | * | |||
* This function adds the test named @p name to @p benchmark. @p | * This function adds the test named @p name to @p benchmark. @p | |||
* bench_cb is the function called when the test is executed. That | * bench_cb is the function called when the test is executed. That | |||
* test can be executed a certain amount of time. @p count_start, @p count_ end and | * test can be executed a certain amount of time. @p count_start, @p count_ end and | |||
* @p count_step define a loop with a step increment. The integer that is | * @p count_step define a loop with a step increment. The integer that is | |||
* increasing by @p count_step from @p count_start to @p count_end is passe d to @p | * increasing by @p count_step from @p count_start to @p count_end is passe d to @p | |||
* bench_cb when eina_benchmark_run() is called. | * bench_cb when eina_benchmark_run() is called. | |||
* | * | |||
* If @p bench is @c NULL, this function returns imediatly. If the | * If @p bench is @c NULL, this function returns immediately. If the | |||
* allocation of the memory of the test to add fails, the error is set | * allocation of the memory of the test to add fails, the error is set | |||
* to #EINA_ERROR_OUT_OF_MEMORY. This function returns #EINA_FALSE | * to #EINA_ERROR_OUT_OF_MEMORY. This function returns #EINA_FALSE | |||
* on failure, #EINA_TRUE otherwise. | * on failure, #EINA_TRUE otherwise. | |||
*/ | */ | |||
EAPI Eina_Bool eina_benchmark_register(Eina_Benchmark *bench , | EAPI Eina_Bool eina_benchmark_register(Eina_Benchmark *bench , | |||
const char *name, | const char *name, | |||
Eina_Benchmark_Specimens bench _cb, | Eina_Benchmark_Specimens bench _cb, | |||
int count _start, | int count _start, | |||
int count _end, | int count _end, | |||
int count _step); | int count _step); | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
eina_binshare.h | eina_binshare.h | |||
---|---|---|---|---|
skipping to change at line 137 | skipping to change at line 137 | |||
/** | /** | |||
* @brief Note that the given object has lost an instance. | * @brief Note that the given object has lost an instance. | |||
* | * | |||
* @param obj object The given object. | * @param obj object The given object. | |||
* | * | |||
* This function decreases the reference counter associated to @p obj | * This function decreases the reference counter associated to @p obj | |||
* if it exists. If that counter reaches 0, the memory associated to | * if it exists. If that counter reaches 0, the memory associated to | |||
* @p obj is freed. If @p obj is @c NULL, the function returns | * @p obj is freed. If @p obj is @c NULL, the function returns | |||
* immediately. | * immediately. | |||
* | * | |||
* Note that if the given pointer is not shared or NULL, bad things | * @note If the given pointer is not shared, bad things will happen, likely | |||
* will happen, likely a segmentation fault. | a | |||
* segmentation fault. | ||||
*/ | */ | |||
EAPI void eina_binshare_del(const void *obj); | EAPI void eina_binshare_del(const void *obj); | |||
/** | /** | |||
* @brief Note that the given object @b must be shared. | * @brief Note that the given object @b must be shared. | |||
* | * | |||
* @param obj the shared object to know the length. It is safe to | * @param obj the shared object to know the length. It is safe to | |||
* give @c NULL, in that case @c -1 is returned. | * give @c NULL, in that case @c -1 is returned. | |||
* @return The length of the shared object. | * @return The length of the shared object. | |||
* | * | |||
* This function is a cheap way to known the length of a shared | * This function is a cheap way to known the length of a shared | |||
* object. Note that if the given pointer is not shared, bad | * object. | |||
* things will happen, likely a segmentation fault. If in doubt, try | * @note If the given pointer is not shared, bad things will happen, likely | |||
* strlen(). | a | |||
* segmentation fault. If in doubt, try strlen(). | ||||
*/ | */ | |||
EAPI int eina_binshare_length(const void *obj) EINA_WARN_UNUSED_RES ULT; | EAPI int eina_binshare_length(const void *obj) EINA_WARN_UNUSED_RES ULT; | |||
/** | /** | |||
* @brief Dump the contents of the share_common. | * @brief Dump the contents of the share_common. | |||
* | * | |||
* This function dumps all objects in the share_common to stdout with a | * This function dumps all objects in the share_common to stdout with a | |||
* DDD: prefix per line and a memory usage summary. | * DDD: prefix per line and a memory usage summary. | |||
*/ | */ | |||
EAPI void eina_binshare_dump(void); | EAPI void eina_binshare_dump(void); | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 7 lines changed or added | |||
eina_config.h | eina_config.h | |||
---|---|---|---|---|
skipping to change at line 71 | skipping to change at line 71 | |||
#endif | #endif | |||
#ifdef EINA_SIZEOF_WCHAR_T | #ifdef EINA_SIZEOF_WCHAR_T | |||
# undef EINA_SIZEOF_WCHAR_T | # undef EINA_SIZEOF_WCHAR_T | |||
#endif | #endif | |||
#define EINA_SIZEOF_WCHAR_T 4 | #define EINA_SIZEOF_WCHAR_T 4 | |||
#ifdef EINA_HAVE_ON_OFF_THREADS | #ifdef EINA_HAVE_ON_OFF_THREADS | |||
# undef EINA_HAVE_ON_OFF_THREADS | # undef EINA_HAVE_ON_OFF_THREADS | |||
#endif | #endif | |||
#define EINA_HAVE_ON_OFF_THREADS | ||||
#ifdef EINA_CONFIGURE_HAVE_DIRENT_H | #ifdef EINA_CONFIGURE_HAVE_DIRENT_H | |||
# undef EINA_CONFIGURE_HAVE_DIRENT_H | # undef EINA_CONFIGURE_HAVE_DIRENT_H | |||
#endif | #endif | |||
#define EINA_HAVE_DIRENT_H | #define EINA_HAVE_DIRENT_H | |||
#ifdef EINA_CONFIGURE_ENABLE_LOG | #ifdef EINA_CONFIGURE_ENABLE_LOG | |||
# undef EINA_CONFIGURE_ENABLE_LOG | # undef EINA_CONFIGURE_ENABLE_LOG | |||
#endif | #endif | |||
#define EINA_ENABLE_LOG | #define EINA_ENABLE_LOG | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||
eina_counter.h | eina_counter.h | |||
---|---|---|---|---|
skipping to change at line 102 | skipping to change at line 102 | |||
* gcc -Wall -o test_eina_counter test_eina.c `pkg-config --cflags --libs e ina` | * gcc -Wall -o test_eina_counter test_eina.c `pkg-config --cflags --libs e ina` | |||
* @endverbatim | * @endverbatim | |||
* | * | |||
* The result should be something like that: | * The result should be something like that: | |||
* | * | |||
* @verbatim | * @verbatim | |||
* \# specimen experiment time starting time ending time | * \# specimen experiment time starting time ending time | |||
* 1 9794125 783816 10577941 | * 1 9794125 783816 10577941 | |||
* @endverbatim | * @endverbatim | |||
* | * | |||
* Note that the displayed time is in nanosecond. | * @note The displayed time is in nanosecond. | |||
*/ | */ | |||
/** | /** | |||
* @addtogroup Eina_Tools_Group Tools | * @addtogroup Eina_Tools_Group Tools | |||
* | * | |||
* @{ | * @{ | |||
*/ | */ | |||
/** | /** | |||
* @defgroup Eina_Counter_Group Counter | * @defgroup Eina_Counter_Group Counter | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
eina_file.h | eina_file.h | |||
---|---|---|---|---|
skipping to change at line 101 | skipping to change at line 101 | |||
typedef struct _Eina_File_Direct_Info Eina_File_Direct_Info; | typedef struct _Eina_File_Direct_Info Eina_File_Direct_Info; | |||
/** | /** | |||
* @typedef Eina_Stat | * @typedef Eina_Stat | |||
* A typedef to #_Eina_Stat. | * A typedef to #_Eina_Stat. | |||
* @since 1.2 | * @since 1.2 | |||
*/ | */ | |||
typedef struct _Eina_Stat Eina_Stat; | typedef struct _Eina_Stat Eina_Stat; | |||
/** | /** | |||
* @typedef Eina_File_Lines | ||||
* A typedef to #_Eina_File_Lines. | ||||
*/ | ||||
typedef struct _Eina_File_Line Eina_File_Line; | ||||
/** | ||||
* @typedef Eina_File_Dir_List_Cb | * @typedef Eina_File_Dir_List_Cb | |||
* Type for a callback to be called when iterating over the files of a | * Type for a callback to be called when iterating over the files of a | |||
* directory. | * directory. | |||
* @param The file name EXCLUDING the path | * @param The file name EXCLUDING the path | |||
* @param path The path passed to eina_file_dir_list() | * @param path The path passed to eina_file_dir_list() | |||
* @param data The data passed to eina_file_dir_list() | * @param data The data passed to eina_file_dir_list() | |||
*/ | */ | |||
typedef void (*Eina_File_Dir_List_Cb)(const char *name, const char *path, v oid *data); | typedef void (*Eina_File_Dir_List_Cb)(const char *name, const char *path, v oid *data); | |||
/** | /** | |||
skipping to change at line 191 | skipping to change at line 197 | |||
unsigned long int blocks; | unsigned long int blocks; | |||
unsigned long int atime; | unsigned long int atime; | |||
unsigned long int atimensec; | unsigned long int atimensec; | |||
unsigned long int mtime; | unsigned long int mtime; | |||
unsigned long int mtimensec; | unsigned long int mtimensec; | |||
unsigned long int ctime; | unsigned long int ctime; | |||
unsigned long int ctimensec; | unsigned long int ctimensec; | |||
}; | }; | |||
/** | /** | |||
* @struct _Eina_File_Line | ||||
* A structure to store information of line | ||||
* @since 1.3 | ||||
*/ | ||||
struct _Eina_File_Line | ||||
{ | ||||
const char *start; | ||||
const char *end; | ||||
unsigned int index; | ||||
unsigned long long length; | ||||
}; | ||||
/** | ||||
* @def EINA_FILE_DIR_LIST_CB | * @def EINA_FILE_DIR_LIST_CB | |||
* @brief cast to an #Eina_File_Dir_List_Cb. | * @brief cast to an #Eina_File_Dir_List_Cb. | |||
* | * | |||
* @param function The function to cast. | * @param function The function to cast. | |||
* | * | |||
* This macro casts @p function to Eina_File_Dir_List_Cb. | * This macro casts @p function to Eina_File_Dir_List_Cb. | |||
*/ | */ | |||
#define EINA_FILE_DIR_LIST_CB(function) ((Eina_File_Dir_List_Cb)function) | #define EINA_FILE_DIR_LIST_CB(function) ((Eina_File_Dir_List_Cb)function) | |||
/** | /** | |||
skipping to change at line 472 | skipping to change at line 491 | |||
* @brief Unref and unmap memory if possible. | * @brief Unref and unmap memory if possible. | |||
* | * | |||
* @param file The file handler to unmap memory from. | * @param file The file handler to unmap memory from. | |||
* @param map Memory map to unref and unmap. | * @param map Memory map to unref and unmap. | |||
* | * | |||
* @since 1.1 | * @since 1.1 | |||
*/ | */ | |||
EAPI void eina_file_map_free(Eina_File *file, void *map); | EAPI void eina_file_map_free(Eina_File *file, void *map); | |||
/** | /** | |||
* @brief Map line by line in memory efficiently with an Eina_Iterator | ||||
* @param file The file to run over | ||||
* @return an Eina_Iterator that will produce @typedef Eina_File_Lines. | ||||
* | ||||
* This function return an iterator that will act like fgets without the | ||||
* useless memcpy. Be aware that once eina_iterator_next has been called, | ||||
* nothing garanty you that the memory will still be mapped. | ||||
* | ||||
* @since 1.3 | ||||
*/ | ||||
EAPI Eina_Iterator *eina_file_map_lines(Eina_File *file); | ||||
/** | ||||
* @brief Tell if their was an IO error during the life of a mmaped file | * @brief Tell if their was an IO error during the life of a mmaped file | |||
* | * | |||
* @param file The file handler to the mmaped file. | * @param file The file handler to the mmaped file. | |||
* @param map Memory map to check if an error occurred on it. | * @param map Memory map to check if an error occurred on it. | |||
* @return #EINA_TRUE if there was an IO error, #EINA_FALSE otherwise. | * @return #EINA_TRUE if there was an IO error, #EINA_FALSE otherwise. | |||
* | * | |||
* @since 1.2 | * @since 1.2 | |||
*/ | */ | |||
EAPI Eina_Bool eina_file_map_faulted(Eina_File *file, void *map); | EAPI Eina_Bool eina_file_map_faulted(Eina_File *file, void *map); | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 32 lines changed or added | |||
eina_hash.h | eina_hash.h | |||
---|---|---|---|---|
skipping to change at line 301 | skipping to change at line 301 | |||
struct _Eina_Hash_Tuple | struct _Eina_Hash_Tuple | |||
{ | { | |||
const void *key; /**< The key */ | const void *key; /**< The key */ | |||
void *data; /**< The data associated to the key */ | void *data; /**< The data associated to the key */ | |||
unsigned int key_length; /**< The length of the key */ | unsigned int key_length; /**< The length of the key */ | |||
}; | }; | |||
typedef unsigned int (*Eina_Key_Length)(const void *key); | typedef unsigned int (*Eina_Key_Length)(const void *key); | |||
/** | /** | |||
* @def EINA_KEY_LENGTH | * @def EINA_KEY_LENGTH | |||
* @param Function The function used to hash calculation. | * @param Function The function used to calculate length of hash key. | |||
*/ | */ | |||
#define EINA_KEY_LENGTH(Function) ((Eina_Key_Length)Function) | #define EINA_KEY_LENGTH(Function) ((Eina_Key_Length)Function) | |||
typedef int (*Eina_Key_Cmp)(const void *key1, int key1_length, con st void *key2, int key2_length); | typedef int (*Eina_Key_Cmp)(const void *key1, int key1_length, con st void *key2, int key2_length); | |||
/** | /** | |||
* @def EINA_KEY_CMP | * @def EINA_KEY_CMP | |||
* @param Function The function used to hash calculation. | * @param Function The function used to compare hash key. | |||
*/ | */ | |||
#define EINA_KEY_CMP(Function) ((Eina_Key_Cmp)Function) | #define EINA_KEY_CMP(Function) ((Eina_Key_Cmp)Function) | |||
typedef int (*Eina_Key_Hash)(const void *key, int key_length); | typedef int (*Eina_Key_Hash)(const void *key, int key_length); | |||
/** | /** | |||
* @def EINA_KEY_HASH | * @def EINA_KEY_HASH | |||
* @param Function The function used to hash calculation. | * @param Function The function used to hash key. | |||
*/ | */ | |||
#define EINA_KEY_HASH(Function) ((Eina_Key_Hash)Function) | #define EINA_KEY_HASH(Function) ((Eina_Key_Hash)Function) | |||
typedef Eina_Bool (*Eina_Hash_Foreach)(const Eina_Hash *hash, const void *key, void *data, void *fdata); | typedef Eina_Bool (*Eina_Hash_Foreach)(const Eina_Hash *hash, const void *key, void *data, void *fdata); | |||
/** | /** | |||
* @brief Create a new hash table. | * @brief Create a new hash table. | |||
* | * | |||
* @param key_length_cb The function called when getting the size of the ke y. | * @param key_length_cb The function called when getting the size of the ke y. | |||
* @param key_cmp_cb The function called when comparing the keys. | * @param key_cmp_cb The function called when comparing the keys. | |||
* @param key_hash_cb The function called when getting the values. | * @param key_hash_cb The function called when getting the values. | |||
skipping to change at line 359 | skipping to change at line 359 | |||
Eina_Key_Hash key_hash_cb, | Eina_Key_Hash key_hash_cb, | |||
Eina_Free_Cb data_free_cb, | Eina_Free_Cb data_free_cb, | |||
int buckets_power_size) EINA_MALL OC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(2, 3); | int buckets_power_size) EINA_MALL OC EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(2, 3); | |||
/** | /** | |||
* @brief Redefine the callback that clean the data of a hash | * @brief Redefine the callback that clean the data of a hash | |||
* | * | |||
* @param hash The given hash table | * @param hash The given hash table | |||
* @param data_free_cb The function called on each value when the hash | * @param data_free_cb The function called on each value when the hash | |||
* table is freed, or when an item is deleted from it. @c NULL can be passe d as | * table is freed, or when an item is deleted from it. @c NULL can be passe d as | |||
* callback. | * callback to remove an existing callback. | |||
* | ||||
* The argument received by @p data_free_cb will be that data of the item b | ||||
eing | ||||
* removed. | ||||
* | ||||
* @since 1.1 | * @since 1.1 | |||
* See @ref eina_hash_new. | * @see eina_hash_new. | |||
*/ | */ | |||
EAPI void eina_hash_free_cb_set(Eina_Hash *hash, Eina_Free_Cb data_free_cb) EINA_ARG_NONNULL(1); | EAPI void eina_hash_free_cb_set(Eina_Hash *hash, Eina_Free_Cb data_free_cb) EINA_ARG_NONNULL(1); | |||
/** | /** | |||
* @brief Create a new hash table using the djb2 algorithm. | * @brief Create a new hash table using the djb2 algorithm. | |||
* | * | |||
* @param data_free_cb The function called on each value when the hash tabl e | * @param data_free_cb The function called on each value when the hash tabl e | |||
* is freed, or when an item is deleted from it. @c NULL can be passed as | * is freed, or when an item is deleted from it. @c NULL can be passed as | |||
* callback. | * callback. | |||
* @return The new hash table. | * @return The new hash table. | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 10 lines changed or added | |||
eina_inarray.h | eina_inarray.h | |||
---|---|---|---|---|
skipping to change at line 79 | skipping to change at line 79 | |||
* We'll now use our array to store ints, so we need to first erase every m ember | * We'll now use our array to store ints, so we need to first erase every m ember | |||
* currently on the array: | * currently on the array: | |||
* @until _flush | * @until _flush | |||
* | * | |||
* And then to be able to store a different type on the same array we use t he | * And then to be able to store a different type on the same array we use t he | |||
* eina_inarray_step_set() function, which is just like the eina_inarray_ne w() | * eina_inarray_step_set() function, which is just like the eina_inarray_ne w() | |||
* function except it receives already allocated memory. This time we're go ing | * function except it receives already allocated memory. This time we're go ing | |||
* to ask eina to use a step of size 4 because that's how many elements we' ll be | * to ask eina to use a step of size 4 because that's how many elements we' ll be | |||
* putting on the array: | * putting on the array: | |||
* @until _step_set | * @until _step_set | |||
* @note Strictly speaking the reason to call eina_inarray_setup() is not | * @note Strictly speaking the reason to call eina_inarray_step_set() is no t | |||
* because we're storing different type, but rather because our types have | * because we're storing different type, but rather because our types have | |||
* different sizes. Eina inline arrays don't actually know anything about t ypes, | * different sizes. Eina inline arrays don't actually know anything about t ypes, | |||
* they only deal in blocks of memory of a given size. | * they only deal in blocks of memory of a given size. | |||
* @note Since eina_inarray_step_set() receives already allocated memory yo u can(and | * @note Since eina_inarray_step_set() receives already allocated memory yo u can(and | |||
* it is in fact good practice) use inline arrays not declared as pointers: | * it is in fact good practice) use inline arrays not declared as pointers: | |||
* @code | * @code | |||
* Eina_Inarray arr; | * Eina_Inarray arr; | |||
* eina_inarray_step_set(&arr, sizeof(arr), sizeof(int), 4); | * eina_inarray_step_set(&arr, sizeof(arr), sizeof(int), 4); | |||
* @endcode | * @endcode | |||
* | * | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
eina_inline_value.x | eina_inline_value.x | |||
---|---|---|---|---|
skipping to change at line 492 | skipping to change at line 492 | |||
EINA_SAFETY_ON_NULL_RETURN_VAL(ptr, EINA_FALSE); | EINA_SAFETY_ON_NULL_RETURN_VAL(ptr, EINA_FALSE); | |||
type = value->type; | type = value->type; | |||
mem = eina_value_memory_get(value); | mem = eina_value_memory_get(value); | |||
eina_error_set(0); | eina_error_set(0); | |||
if (EINA_VALUE_TYPE_DEFAULT(type)) | if (EINA_VALUE_TYPE_DEFAULT(type)) | |||
{ | { | |||
if (type == EINA_VALUE_TYPE_STRINGSHARE) | if (type == EINA_VALUE_TYPE_STRINGSHARE) | |||
{ | { | |||
const char * const *pstr = (const char * const *) ptr; | const char *str = *((const char * const *) ptr); | |||
const char *str = *pstr; | ||||
return eina_stringshare_replace((const char **)&value->value.p tr, | return eina_stringshare_replace((const char **)&value->value.p tr, | |||
str); | str); | |||
} | } | |||
else if (type == EINA_VALUE_TYPE_STRING) | else if (type == EINA_VALUE_TYPE_STRING) | |||
{ | { | |||
const char * const * pstr = (const char * const *) ptr; | const char *str = *((const char * const *) ptr); | |||
const char *str = *pstr; | ||||
if (value->value.ptr == str) return EINA_TRUE; | if (value->value.ptr == str) return EINA_TRUE; | |||
if (!str) | if (!str) | |||
{ | { | |||
free(value->value.ptr); | free(value->value.ptr); | |||
value->value.ptr = NULL; | value->value.ptr = NULL; | |||
} | } | |||
else | else | |||
{ | { | |||
char *tmp = strdup(str); | char *tmp = strdup(str); | |||
if (!tmp) | if (!tmp) | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 2 lines changed or added | |||
eina_inlist.h | eina_inlist.h | |||
---|---|---|---|---|
skipping to change at line 343 | skipping to change at line 343 | |||
* since it is the only one that has the correct information to allow a pro per | * since it is the only one that has the correct information to allow a pro per | |||
* O(1) append to the list. | * O(1) append to the list. | |||
* | * | |||
* @section inlist_perf Performance | * @section inlist_perf Performance | |||
* | * | |||
* Due to the nature of the inlist, there's no accounting information, and no | * Due to the nature of the inlist, there's no accounting information, and no | |||
* easy access to the last element from each list node. This means that @re f | * easy access to the last element from each list node. This means that @re f | |||
* eina_inlist_count() is order-N, while @ref eina_list_count() is order-1 (constant | * eina_inlist_count() is order-N, while @ref eina_list_count() is order-1 (constant | |||
* time). | * time). | |||
* | * | |||
* For the same reasons, @ref eina_inlist_sort() is slower than @ref | ||||
* eina_list_sort() . If the list is intended to have faster access, be | ||||
* sorted/merged frequently, or needs to have other complex operations, con | ||||
sider | ||||
* using @ref Eina_List instead. | ||||
* | ||||
* @section inlist_advanced Advanced Usage | * @section inlist_advanced Advanced Usage | |||
* | * | |||
* The basic usage considers a struct that will have the user data, and als o | * The basic usage considers a struct that will have the user data, and als o | |||
* have an inlist node information (prev, next and last pointers) created w ith | * have an inlist node information (prev, next and last pointers) created w ith | |||
* @ref EINA_INLIST during the struct declaration. This allows one to use t he | * @ref EINA_INLIST during the struct declaration. This allows one to use t he | |||
* convenience macros @ref EINA_INLIST_GET(), @ref EINA_INLIST_CONTAINER_GE T(), | * convenience macros @ref EINA_INLIST_GET(), @ref EINA_INLIST_CONTAINER_GE T(), | |||
* @ref EINA_INLIST_FOREACH() and so. This happens because the @ref EINA_IN LIST | * @ref EINA_INLIST_FOREACH() and so. This happens because the @ref EINA_IN LIST | |||
* macro declares a struct member with the name @a __inlist, and all the ot her | * macro declares a struct member with the name @a __inlist, and all the ot her | |||
* macros assume that this struct member has this name. | * macros assume that this struct member has this name. | |||
* | * | |||
skipping to change at line 741 | skipping to change at line 736 | |||
* nodes. | * nodes. | |||
* @return the new head of list. | * @return the new head of list. | |||
* | * | |||
* This function sorts all the elements of @p head. @p func is used to | * This function sorts all the elements of @p head. @p func is used to | |||
* compare two elements of @p head. If @p head or @p func are @c NULL, | * compare two elements of @p head. If @p head or @p func are @c NULL, | |||
* this function returns @c NULL. | * this function returns @c NULL. | |||
* | * | |||
* @note @b in-place: this will change the given list, so you should | * @note @b in-place: this will change the given list, so you should | |||
* now point to the new list head that is returned by this function. | * now point to the new list head that is returned by this function. | |||
* | * | |||
* @note worst case is O(n * log2(n)) comparisons (calls to func()), | * @note Worst case is O(n * log2(n)) comparisons (calls to func()). | |||
* O(n) comparisons average case. That means that for 1,000,000 list | * That means that for 1,000,000 list elements, sort will do 20,000,000 | |||
* elements, sort will usually do 1,000,000 comparisons, but may do up | * comparisons. | |||
* to 20,000,000. | ||||
* | * | |||
* Example: | * Example: | |||
* @code | * @code | |||
* typedef struct _Sort_Ex Sort_Ex; | * typedef struct _Sort_Ex Sort_Ex; | |||
* struct _Sort_Ex | * struct _Sort_Ex | |||
* { | * { | |||
* INLIST; | * INLIST; | |||
* const char *text; | * const char *text; | |||
* }; | * }; | |||
* | * | |||
End of changes. 2 change blocks. | ||||
10 lines changed or deleted | 3 lines changed or added | |||
eina_iterator.h | eina_iterator.h | |||
---|---|---|---|---|
skipping to change at line 96 | skipping to change at line 96 | |||
* @addtogroup Eina_Iterator_Group Iterator Functions | * @addtogroup Eina_Iterator_Group Iterator Functions | |||
* | * | |||
* @brief These functions manage iterators on containers. | * @brief These functions manage iterators on containers. | |||
* | * | |||
* These functions allow to access elements of a container in a | * These functions allow to access elements of a container in a | |||
* generic way, without knowing which container is used (a bit like | * generic way, without knowing which container is used (a bit like | |||
* iterators in the C++ STL). Iterators only allows sequential access | * iterators in the C++ STL). Iterators only allows sequential access | |||
* (that is, from an element to the next one). For random access, see | * (that is, from an element to the next one). For random access, see | |||
* @ref Eina_Accessor_Group. | * @ref Eina_Accessor_Group. | |||
* | * | |||
* An iterator is created from container data types, so no creation | * Getting an iterator to access elements of a given container is done thro | |||
* function is available here. An iterator is deleted with | ugh | |||
* eina_iterator_free(). To get the data and iterate, use | * the functions of that particular container. There is no function to crea | |||
* eina_iterator_next(). To call a function on all the elements of a | te | |||
* container, use eina_iterator_foreach(). | * a generic iterator as iterators absolutely depend on the container. This | |||
* means you won't find iterator creation function here, those can be found | ||||
on | ||||
* the documentation of the container type you're using. Though created wit | ||||
h | ||||
* container specific functions iterators are always deleted with the same | ||||
* function: eina_iterator_free(). | ||||
* | ||||
* To get the data and iterate, use eina_iterator_next(). To call a functio | ||||
n on | ||||
* all the elements of a container, use eina_iterator_foreach(). | ||||
* | * | |||
* Here an @ref eina_iterator_example_page "example" | * Here an @ref eina_iterator_example_page "example" | |||
*/ | */ | |||
/** | /** | |||
* @addtogroup Eina_Content_Access_Group Content Access | * @addtogroup Eina_Content_Access_Group Content Access | |||
* | * | |||
* @{ | * @{ | |||
*/ | */ | |||
skipping to change at line 150 | skipping to change at line 155 | |||
/** | /** | |||
* @typedef Eina_Iterator_Lock_Callback | * @typedef Eina_Iterator_Lock_Callback | |||
* Type for a callback that lock the container. | * Type for a callback that lock the container. | |||
*/ | */ | |||
typedef Eina_Bool (*Eina_Iterator_Lock_Callback)(Eina_Iterator *i t); | typedef Eina_Bool (*Eina_Iterator_Lock_Callback)(Eina_Iterator *i t); | |||
/** | /** | |||
* @struct _Eina_Iterator | * @struct _Eina_Iterator | |||
* structure of an iterator | * structure of an iterator | |||
* | ||||
* If creating an iterator remember to set the type using @ref EINA_MAGIC_S | ||||
ET. | ||||
*/ | */ | |||
struct _Eina_Iterator | struct _Eina_Iterator | |||
{ | { | |||
#define EINA_ITERATOR_VERSION 1 | #define EINA_ITERATOR_VERSION 1 | |||
int version; /**< Version of the Iterat or API. */ | int version; /**< Version of the Iterat or API. */ | |||
Eina_Iterator_Next_Callback next EINA_ARG_NONNULL(1, 2 ) EINA_WARN_UNUSED_RESULT; /**< Callback called when a next element is requ ested. */ | Eina_Iterator_Next_Callback next EINA_ARG_NONNULL(1, 2 ) EINA_WARN_UNUSED_RESULT; /**< Callback called when a next element is requ ested. */ | |||
Eina_Iterator_Get_Container_Callback get_container EINA_ARG_NONNULL(1) E INA_WARN_UNUSED_RESULT; /**< Callback called when the container is requeste d. */ | Eina_Iterator_Get_Container_Callback get_container EINA_ARG_NONNULL(1) E INA_WARN_UNUSED_RESULT; /**< Callback called when the container is requeste d. */ | |||
Eina_Iterator_Free_Callback free EINA_ARG_NONNULL(1); /**< Callback called when the container is freed. */ | Eina_Iterator_Free_Callback free EINA_ARG_NONNULL(1); /**< Callback called when the container is freed. */ | |||
skipping to change at line 198 | skipping to change at line 205 | |||
*/ | */ | |||
#define FUNC_ITERATOR_LOCK(Function) ((Eina_Iterator_Lock_Callback )Function) | #define FUNC_ITERATOR_LOCK(Function) ((Eina_Iterator_Lock_Callback )Function) | |||
/** | /** | |||
* @brief Free an iterator. | * @brief Free an iterator. | |||
* | * | |||
* @param iterator The iterator to free. | * @param iterator The iterator to free. | |||
* | * | |||
* This function frees @p iterator if it is not @c NULL; | * This function frees @p iterator if it is not @c NULL; | |||
*/ | */ | |||
EAPI void eina_iterator_free(Eina_Iterator *iterator) EINA_ARG_NONNULL (1); | EAPI void eina_iterator_free(Eina_Iterator *iterator); | |||
/** | /** | |||
* @brief Return the container of an iterator. | * @brief Return the container of an iterator. | |||
* | * | |||
* @param iterator The iterator. | * @param iterator The iterator. | |||
* @return The container which created the iterator. | * @return The container which created the iterator. | |||
* | * | |||
* This function returns the container which created @p iterator. If | * This function returns the container which created @p iterator. If | |||
* @p iterator is @c NULL, this function returns @c NULL. | * @p iterator is @c NULL, this function returns @c NULL. | |||
*/ | */ | |||
skipping to change at line 224 | skipping to change at line 231 | |||
* @param iterator The iterator. | * @param iterator The iterator. | |||
* @param data The data of the element. | * @param data The data of the element. | |||
* @return #EINA_TRUE on success, #EINA_FALSE otherwise. | * @return #EINA_TRUE on success, #EINA_FALSE otherwise. | |||
* | * | |||
* This function returns the value of the current element pointed by | * This function returns the value of the current element pointed by | |||
* @p iterator in @p data, then goes to the next element. If @p | * @p iterator in @p data, then goes to the next element. If @p | |||
* iterator is @c NULL or if a problem occurred, #EINA_FALSE is | * iterator is @c NULL or if a problem occurred, #EINA_FALSE is | |||
* returned, otherwise #EINA_TRUE is returned. | * returned, otherwise #EINA_TRUE is returned. | |||
*/ | */ | |||
EAPI Eina_Bool eina_iterator_next(Eina_Iterator *iterator, | EAPI Eina_Bool eina_iterator_next(Eina_Iterator *iterator, | |||
void **data) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; | void **data) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; | |||
/** | /** | |||
* @brief Iterate over the container and execute a callback on each element . | * @brief Iterate over the container and execute a callback on each element . | |||
* | * | |||
* @param iterator The iterator. | * @param iterator The iterator. | |||
* @param callback The callback called on each iteration. | * @param callback The callback called on each iteration. | |||
* @param fdata The data passed to the callback. | * @param fdata The data passed to the callback. | |||
* | * | |||
* This function iterates over the elements pointed by @p iterator, | * This function iterates over the elements pointed by @p iterator, | |||
* beginning from the current element. For Each element, the callback | * beginning from the current element. For Each element, the callback | |||
* @p cb is called with the data @p fdata. If @p iterator is @c NULL, | * @p cb is called with the data @p fdata. If @p iterator is @c NULL, | |||
* the function returns immediately. Also, if @p cb returns #EINA_FALSE, | * the function returns immediately. Also, if @p cb returns #EINA_FALSE, | |||
* the iteration stops at that point, if @p cb returns #EINA_TRUE | * the iteration stops at that point, if @p cb returns #EINA_TRUE | |||
* the iteration continues. | * the iteration continues. | |||
*/ | */ | |||
EAPI void eina_iterator_foreach(Eina_Iterator *iterator, | EAPI void eina_iterator_foreach(Eina_Iterator *iterator, | |||
Eina_Each_Cb callback, | Eina_Each_Cb callback, | |||
const void *fdata) EINA_ARG_NONNULL(1, 2 ); | const void *fdata) EINA_ARG_NONNULL(2); | |||
/** | /** | |||
* @brief Lock the container of the iterator. | * @brief Lock the container of the iterator. | |||
* | * | |||
* @param iterator The iterator. | * @param iterator The iterator. | |||
* @return #EINA_TRUE on success, #EINA_FALSE otherwise. | * @return #EINA_TRUE on success, #EINA_FALSE otherwise. | |||
* | * | |||
* If the container of the @p iterator permits it, it will be locked. When a | * If the container of the @p iterator permits it, it will be locked. When a | |||
* container is locked calling eina_iterator_foreach() on it will return | * container is locked calling eina_iterator_foreach() on it will return | |||
* immediately. If @p iterator is @c NULL or if a problem occurred, #EINA_F ALSE | * immediately. If @p iterator is @c NULL or if a problem occurred, #EINA_F ALSE | |||
End of changes. 5 change blocks. | ||||
8 lines changed or deleted | 21 lines changed or added | |||
eina_list.h | eina_list.h | |||
---|---|---|---|---|
skipping to change at line 565 | skipping to change at line 565 | |||
EAPI Eina_List *eina_list_sorted_insert(Eina_List *list, Eina_Co mpare_Cb func, const void *data) EINA_ARG_NONNULL(2, 3) EINA_WARN_UNUSED_RE SULT; | EAPI Eina_List *eina_list_sorted_insert(Eina_List *list, Eina_Co mpare_Cb func, const void *data) EINA_ARG_NONNULL(2, 3) EINA_WARN_UNUSED_RE SULT; | |||
/** | /** | |||
* @brief Remove the first instance of the specified data from the given li st. | * @brief Remove the first instance of the specified data from the given li st. | |||
* | * | |||
* @param list The given list. | * @param list The given list. | |||
* @param data The specified data. | * @param data The specified data. | |||
* @return A list pointer. | * @return A list pointer. | |||
* | * | |||
* This function removes the first instance of @p data from | * This function removes the first instance of @p data from | |||
* @p list. If the specified data is not in the given list (tihis | * @p list. If the specified data is not in the given list (this | |||
* include the case where @p data is @c NULL), nothing is done. If | * includes the case where @p data is @c NULL), nothing is done and the | |||
* @p list is @c NULL, @c NULL is returned, otherwise a new list | * specified @p list returned. If @p list is @c NULL, @c NULL is returned, | |||
* pointer that should be used in place of the one passed to this | * otherwise a new list pointer that should be used in place of the one | |||
* function. | * passed to this function. | |||
* | * | |||
* @warning @p list must be a pointer to the first element of the list. | * @warning @p list must be a pointer to the first element of the list. | |||
*/ | */ | |||
EAPI Eina_List *eina_list_remove(Eina_List *list, const void *da ta) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; | EAPI Eina_List *eina_list_remove(Eina_List *list, const void *da ta) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; | |||
/** | /** | |||
* @brief Remove the specified list node. | * @brief Remove the specified list node. | |||
* | * | |||
* @param list The given linked list. | * @param list The given linked list. | |||
* @param remove_list The list node which is to be removed. | * @param remove_list The list node which is to be removed. | |||
skipping to change at line 878 | skipping to change at line 878 | |||
* | * | |||
* This function sorts @p list. @p size if the number of the first | * This function sorts @p list. @p size if the number of the first | |||
* element to sort. If @p limit is 0 or greater than the number of | * element to sort. If @p limit is 0 or greater than the number of | |||
* elements in @p list, all the elements are sorted. @p func is used to | * elements in @p list, all the elements are sorted. @p func is used to | |||
* compare two elements of @p list. If @p list or @p func are @c NULL, | * compare two elements of @p list. If @p list or @p func are @c NULL, | |||
* this function returns @c NULL. | * this function returns @c NULL. | |||
* | * | |||
* @note @b in-place: this will change the given list, so you should | * @note @b in-place: this will change the given list, so you should | |||
* now point to the new list head that is returned by this function. | * now point to the new list head that is returned by this function. | |||
* | * | |||
* @note worst case is O(n * log2(n)) comparisons (calls to func()), | * @note Worst case is O(n * log2(n)) comparisons (calls to func()). | |||
* O(n) comparisons average case. That means that for 1,000,000 list | * That means that for 1,000,000 list sort will do 20,000,000 comparisons. | |||
* elements, sort will usually do 1,000,000 comparisons, but may do up | ||||
* to 20,000,000. | ||||
* | * | |||
* Example: | * Example: | |||
* @code | * @code | |||
* int | * int | |||
* sort_cb(const void *d1, const void *d2) | * sort_cb(const void *d1, const void *d2) | |||
* { | * { | |||
* const char *txt = d1; | * const char *txt = d1; | |||
* const char *txt2 = d2; | * const char *txt2 = d2; | |||
* | * | |||
* if(!txt) return(1); | * if(!txt) return(1); | |||
End of changes. 2 change blocks. | ||||
9 lines changed or deleted | 7 lines changed or added | |||
eina_log.h | eina_log.h | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
* Lesser General Public License for more details. | * Lesser General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; | * License along with this library; | |||
* if not, see <http://www.gnu.org/licenses/>. | * if not, see <http://www.gnu.org/licenses/>. | |||
*/ | */ | |||
#ifndef EINA_LOG_H_ | #ifndef EINA_LOG_H_ | |||
#define EINA_LOG_H_ | #define EINA_LOG_H_ | |||
#include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include "eina_types.h" | #include "eina_types.h" | |||
#define EINA_COLOR_LIGHTRED "\033[31;1m" | #define EINA_COLOR_LIGHTRED "\033[31;1m" | |||
#define EINA_COLOR_RED "\033[31m" | #define EINA_COLOR_RED "\033[31m" | |||
#define EINA_COLOR_LIGHTBLUE "\033[34;1m" | #define EINA_COLOR_LIGHTBLUE "\033[34;1m" | |||
#define EINA_COLOR_BLUE "\033[34m" | #define EINA_COLOR_BLUE "\033[34m" | |||
skipping to change at line 681 | skipping to change at line 682 | |||
EAPI int eina_log_domain_level_get(const char *domain_name) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); | EAPI int eina_log_domain_level_get(const char *domain_name) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); | |||
/** | /** | |||
* Get the domain level given its identifier. | * Get the domain level given its identifier. | |||
* | * | |||
* @param domain identifier, so it must be previously registered with | * @param domain identifier, so it must be previously registered with | |||
* eina_log_domain_register(). It's a much faster version of | * eina_log_domain_register(). It's a much faster version of | |||
* eina_log_domain_level_get(), but relies on domain being | * eina_log_domain_level_get(), but relies on domain being | |||
* present. | * present. | |||
* | * | |||
* @return level to use to limit eina_log_print() for given domain. On | * @return #EINA_TRUE if level should be printed, #EINA_FALSE if not. | |||
* error EINA_LOG_LEVEL_UNKNOWN is returned. | * (domain's level is greater or equal @a level). | |||
*/ | */ | |||
EAPI int eina_log_domain_registered_level_get(int domain) EI NA_WARN_UNUSED_RESULT; | EAPI int eina_log_domain_registered_level_get(int domain) EI NA_WARN_UNUSED_RESULT; | |||
static inline Eina_Bool eina_log_domain_level_check(int domain, int level); | static inline Eina_Bool eina_log_domain_level_check(int domain, int level); | |||
/* | /* | |||
* Logging domains | * Logging domains | |||
*/ | */ | |||
/** | /** | |||
skipping to change at line 889 | skipping to change at line 890 | |||
*/ | */ | |||
EAPI void eina_log_print_cb_file(const Eina_Log_Domain *d, | EAPI void eina_log_print_cb_file(const Eina_Log_Domain *d, | |||
Eina_Log_Level level, | Eina_Log_Level level, | |||
const char *file, | const char *file, | |||
const char *fnc, | const char *fnc, | |||
int line, | int line, | |||
const char *fmt, | const char *fmt, | |||
void *data, | void *data, | |||
va_list args); | va_list args); | |||
/** | ||||
* Configure console color of given file. | ||||
* | ||||
* @param fp file to configure console color (usually stderr or stdout). | ||||
* @param color a VT color code such as #EINA_COLOR_RED or #EINA_COLOR_RESE | ||||
T. | ||||
* | ||||
* @note if color is disabled, nothing is done. See | ||||
* eina_log_color_disable_get() | ||||
* @note on windows, both @a fp and @a color is converted automatically. | ||||
* | ||||
* @since 1.7 | ||||
*/ | ||||
EAPI void eina_log_console_color_set(FILE *fp, | ||||
const char *color) EINA_ARG_NONNULL(1, | ||||
2); | ||||
#include "eina_inline_log.x" | #include "eina_inline_log.x" | |||
/** | /** | |||
* @} | * @} | |||
*/ | */ | |||
/** | /** | |||
* @} | * @} | |||
*/ | */ | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 20 lines changed or added | |||
eina_main.h | eina_main.h | |||
---|---|---|---|---|
skipping to change at line 53 | skipping to change at line 53 | |||
/** | /** | |||
* @def EINA_VERSION_MAJOR | * @def EINA_VERSION_MAJOR | |||
* @brief Major version of Eina | * @brief Major version of Eina | |||
*/ | */ | |||
#define EINA_VERSION_MAJOR 1 | #define EINA_VERSION_MAJOR 1 | |||
/** | /** | |||
* @def EINA_VERSION_MINOR | * @def EINA_VERSION_MINOR | |||
* @brief Minor version of Eina | * @brief Minor version of Eina | |||
*/ | */ | |||
#define EINA_VERSION_MINOR 2 | #define EINA_VERSION_MINOR 7 | |||
/** | /** | |||
* @typedef Eina_Version | * @typedef Eina_Version | |||
* The version of Eina. | * The version of Eina. | |||
*/ | */ | |||
typedef struct _Eina_Version | typedef struct _Eina_Version | |||
{ | { | |||
int major; /**< Major component of the version */ | int major; /**< Major component of the version */ | |||
int minor; /**< Minor component of the version */ | int minor; /**< Minor component of the version */ | |||
int micro; /**< Micro component of the version */ | int micro; /**< Micro component of the version */ | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
eina_matrixsparse.h | eina_matrixsparse.h | |||
---|---|---|---|---|
skipping to change at line 320 | skipping to change at line 320 | |||
* | * | |||
* @param m the sparse matrix to operate on. | * @param m the sparse matrix to operate on. | |||
* @param row the new number of row to clear. | * @param row the new number of row to clear. | |||
* @param col the new number of column to clear. | * @param col the new number of column to clear. | |||
* | * | |||
* @return #EINA_TRUE on success, #EINA_FALSE on failure. It is considered success if did not | * @return #EINA_TRUE on success, #EINA_FALSE on failure. It is considered success if did not | |||
* exist but index is inside matrix size. | * exist but index is inside matrix size. | |||
* | * | |||
* @warning cells, rows or columns are not reference counted and thus | * @warning cells, rows or columns are not reference counted and thus | |||
* after this call any reference might be invalid if instance were | * after this call any reference might be invalid if instance were | |||
* freed. Note that this call might delete container column and | * freed. | |||
* row if this cell was the last remainder. | * | |||
* @note This call might delete container column and row if this cell was t | ||||
he | ||||
* last remainder. | ||||
*/ | */ | |||
EAPI Eina_Bool eina_matrixsparse_cell_idx_clear(Eina_Matrixsparse *m, unsig ned long row, unsigned long col); | EAPI Eina_Bool eina_matrixsparse_cell_idx_clear(Eina_Matrixsparse *m, unsig ned long row, unsigned long col); | |||
/** | /** | |||
* Clear (erase) cell given its reference. | * Clear (erase) cell given its reference. | |||
* | * | |||
* @param cell the cell reference, must @b not be @c NULL. | * @param cell the cell reference, must @b not be @c NULL. | |||
* | * | |||
* @return #EINA_TRUE on success, #EINA_FALSE on failure. | * @return #EINA_TRUE on success, #EINA_FALSE on failure. | |||
* | * | |||
* @warning cells, rows or columns are not reference counted and thus | * @warning cells, rows or columns are not reference counted and thus | |||
* after this call any reference might be invalid if instance were | * after this call any reference might be invalid if instance were | |||
* freed. Note that this call might delete container column and | * freed. | |||
* row if this cell was the last remainder. | * | |||
* @note This call might delete container column and row if this cell was t | ||||
he | ||||
* last remainder. | ||||
*/ | */ | |||
EAPI Eina_Bool eina_matrixsparse_cell_clear(Eina_Matrixsparse_Cell *cell); | EAPI Eina_Bool eina_matrixsparse_cell_clear(Eina_Matrixsparse_Cell *cell); | |||
/* iterators */ | /* iterators */ | |||
/** | /** | |||
* Creates a new iterator over existing matrix cells. | * Creates a new iterator over existing matrix cells. | |||
* | * | |||
* This is a cheap walk, it will just report existing cells and holes | * This is a cheap walk, it will just report existing cells and holes | |||
* in the sparse matrix will be ignored. That means the reported | * in the sparse matrix will be ignored. That means the reported | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 10 lines changed or added | |||
eina_rectangle.h | eina_rectangle.h | |||
---|---|---|---|---|
skipping to change at line 140 | skipping to change at line 140 | |||
* function does nothing. | * function does nothing. | |||
*/ | */ | |||
EAPI void eina_rectangle_pool_data_set(Eina_Rectangle_Pool *pool, const void *data) EINA_ARG_NONNULL(1); | EAPI void eina_rectangle_pool_data_set(Eina_Rectangle_Pool *pool, const void *data) EINA_ARG_NONNULL(1); | |||
/** | /** | |||
* @brief Free the given pool. | * @brief Free the given pool. | |||
* | * | |||
* @param pool The pool to free. | * @param pool The pool to free. | |||
* | * | |||
* This function frees the allocated data of @p pool. If @p pool is | * This function frees the allocated data of @p pool. If @p pool is | |||
* @c NULL, ths function returned immediately. | * @c NULL, this function returned immediately. | |||
*/ | */ | |||
EAPI void eina_rectangle_pool_free(Eina_Rectangle_Pool *poo l) EINA_ARG_NONNULL(1); | EAPI void eina_rectangle_pool_free(Eina_Rectangle_Pool *poo l) EINA_ARG_NONNULL(1); | |||
/** | /** | |||
* @brief Return the number of rectangles in the given pool. | * @brief Return the number of rectangles in the given pool. | |||
* | * | |||
* @param pool The pool. | * @param pool The pool. | |||
* @return The number of rectangles in the pool. | * @return The number of rectangles in the pool. | |||
* | * | |||
* This function returns the number of rectangles in @p pool. | * This function returns the number of rectangles in @p pool. | |||
skipping to change at line 177 | skipping to change at line 177 | |||
* Otherwise it returns @c NULL. | * Otherwise it returns @c NULL. | |||
*/ | */ | |||
EAPI Eina_Rectangle *eina_rectangle_pool_request(Eina_Rectangle_Pool * pool, int w, int h) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); | EAPI Eina_Rectangle *eina_rectangle_pool_request(Eina_Rectangle_Pool * pool, int w, int h) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); | |||
/** | /** | |||
* @brief Remove the given rectangle from the pool. | * @brief Remove the given rectangle from the pool. | |||
* | * | |||
* @param rect The rectangle to remove from the pool. | * @param rect The rectangle to remove from the pool. | |||
* | * | |||
* This function removes @p rect from the pool. If @p rect is | * This function removes @p rect from the pool. If @p rect is | |||
* @c NULL, the function returns immediately. Otherwise it remoes @p | * @c NULL, the function returns immediately. Otherwise it removes @p | |||
* rect from the pool. | * rect from the pool. | |||
*/ | */ | |||
EAPI void eina_rectangle_pool_release(Eina_Rectangle *rect) EINA_ARG_NONNULL(1); | EAPI void eina_rectangle_pool_release(Eina_Rectangle *rect) EINA_ARG_NONNULL(1); | |||
/** | /** | |||
* @def EINA_RECTANGLE_SET | * @def EINA_RECTANGLE_SET | |||
* @brief Macro to set the values of a #Eina_Rectangle. | * @brief Macro to set the values of a #Eina_Rectangle. | |||
* | * | |||
* @param Rectangle The rectangle to set the values. | * @param Rectangle The rectangle to set the values. | |||
* @param X The X coordinate of the top left corner of the rectangle. | * @param X The X coordinate of the top left corner of the rectangle. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
eina_str.h | eina_str.h | |||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
* @dontinclude eina_str_01.c | * @dontinclude eina_str_01.c | |||
* | * | |||
* Whenever using eina we need to include it: | * Whenever using eina we need to include it: | |||
* @skipline #include | * @skipline #include | |||
* @line #include | * @line #include | |||
* | * | |||
* In our main function we declare(and initialize) some variables and initi alize | * In our main function we declare(and initialize) some variables and initi alize | |||
* eina: | * eina: | |||
* @until eina_init | * @until eina_init | |||
* | * | |||
* It's frequentely necessary to split a string into its constituent parts, | * It's frequently necessary to split a string into its constituent parts, | |||
* eina_str_split() make's it easy to do so: | * eina_str_split() make's it easy to do so: | |||
* @until printf | * @until printf | |||
* | * | |||
* Another common need is to make a string uppercase or lowercase, so let's | * Another common need is to make a string uppercase or lowercase, so let's | |||
* create a string and make it uppercase and then make it lowercase again: | * create a string and make it uppercase and then make it lowercase again: | |||
* @until printf | * @until printf | |||
* @until printf | * @until printf | |||
* | * | |||
* Next we use eina to check if our @p names string starts or ends with som e | * Next we use eina to check if our @p names string starts or ends with som e | |||
* values: | * values: | |||
skipping to change at line 165 | skipping to change at line 165 | |||
* This function does the same as eina_str_has_suffix(), except it's case | * This function does the same as eina_str_has_suffix(), except it's case | |||
* insensitive. | * insensitive. | |||
*/ | */ | |||
EAPI Eina_Bool eina_str_has_extension(const char *str, const char *ex t) EINA_PURE EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; | EAPI Eina_Bool eina_str_has_extension(const char *str, const char *ex t) EINA_PURE EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT; | |||
/** | /** | |||
* @brief Split a string using a delimiter. | * @brief Split a string using a delimiter. | |||
* | * | |||
* @param string The string to split. | * @param string The string to split. | |||
* @param delimiter The string which specifies the places at which to split the string. | * @param delimiter The string which specifies the places at which to split the string. | |||
* @param max_tokens The maximum number of strings to split string into. | * @param max_tokens The maximum number of strings to split string into, or | |||
a number less | ||||
* than 1 to split as many times as possible. This parame | ||||
ter | ||||
* IGNORES the added @c NULL terminator. | ||||
* @return A newly-allocated NULL-terminated array of strings or @c NULL if it | * @return A newly-allocated NULL-terminated array of strings or @c NULL if it | |||
* fails to allocate the array. | * fails to allocate the array. | |||
* | * | |||
* This functin splits @p string into a maximum of @p max_tokens pieces, | * This function splits @p string into a maximum of @p max_tokens pieces, | |||
* using the given delimiter @p delimiter. @p delimiter is not included in any | * using the given delimiter @p delimiter. @p delimiter is not included in any | |||
* of the resulting strings, unless @p max_tokens is reached. If | * of the resulting strings, unless @p max_tokens is reached. If | |||
* @p max_tokens is less than @c 1, the string is splitted completely. If | * @p max_tokens is less than @c 1, the string is splitted as many times as possible. If | |||
* @p max_tokens is reached, the last string in the returned string | * @p max_tokens is reached, the last string in the returned string | |||
* array contains the remainder of string. The returned value is a | * array contains the remainder of string. The returned value is a | |||
* newly allocated NULL-terminated array of strings or @c NULL if it fails to | * newly allocated NULL-terminated array of strings or @c NULL if it fails to | |||
* allocate the array. To free it, free the first element of the array and the | * allocate the array. To free it, free the first element of the array and the | |||
* array itself. | * array itself. | |||
* | * | |||
* @note If you need the number of elements in the returned array see | * @note If you need the number of elements in the returned array see | |||
* eina_str_split_full(). | * eina_str_split_full(). | |||
*/ | */ | |||
EAPI char **eina_str_split(const char *string, const char *delimit er, int max_tokens) EINA_ARG_NONNULL(1, 2) EINA_MALLOC EINA_WARN_UNUSED_RES ULT; | EAPI char **eina_str_split(const char *string, const char *delimit er, int max_tokens) EINA_ARG_NONNULL(1, 2) EINA_MALLOC EINA_WARN_UNUSED_RES ULT; | |||
/** | /** | |||
* @brief Split a string using a delimiter and returns number of elements. | * @brief Split a string using a delimiter and returns number of elements. | |||
* | * | |||
* @param string The string to split. | * @param string The string to split. | |||
* @param delimiter The string which specifies the places at which to split the string. | * @param delimiter The string which specifies the places at which to split the string. | |||
* @param max_tokens The maximum number of strings to split string into. | * @param max_tokens The maximum number of strings to split string into, or | |||
a number less | ||||
* than 1 to split as many times as possible. This parame | ||||
ter | ||||
* IGNORES the added @c NULL terminator. | ||||
* @param elements Where to return the number of elements in returned | * @param elements Where to return the number of elements in returned | |||
* array (not counting the terminating @c NULL). May be @c NULL. | * array. This array is guaranteed to be no greater than @p max_toke | |||
ns, and | ||||
* it will NOT count the @c NULL terminator element. | ||||
* @return A newly-allocated NULL-terminated array of strings or @c NULL if it | * @return A newly-allocated NULL-terminated array of strings or @c NULL if it | |||
* fails to allocate the array. | * fails to allocate the array. | |||
* | * | |||
* This function splits @p string into a maximum of @p max_tokens pieces, | * This function splits @p string into a maximum of @p max_tokens pieces, | |||
* using the given delimiter @p delimiter. @p delimiter is not included in any | * using the given delimiter @p delimiter. @p delimiter is not included in any | |||
* of the resulting strings, unless @p max_tokens is reached. If | * of the resulting strings, unless @p max_tokens is reached. If | |||
* @p max_tokens is less than @c 1, the string is splitted completely. If | * @p max_tokens is less than @c 1, the string is splitted as many times as possible. If | |||
* @p max_tokens is reached, the last string in the returned string | * @p max_tokens is reached, the last string in the returned string | |||
* array contains the remainder of string. The returned value is a | * array contains the remainder of string. The returned value is a | |||
* newly allocated NULL-terminated array of strings or @c NULL if it fails to | * newly allocated NULL-terminated array of strings or @c NULL if it fails to | |||
* allocate the array. To free it, free the first element of the array and the | * allocate the array. To free it, free the first element of the array and the | |||
* array itself. | * array itself. | |||
* | * | |||
* @note The actual size of the returned array, when @p elements returns gr | ||||
eater than zero, | ||||
* will always be @p elements + 1. This is due to the @c NULL termina | ||||
tor element that | ||||
* is added to the array for safety. If it returns @c 6, the number o | ||||
f split strings returned | ||||
* will be 6, but the size of the array (including the @c NULL elemen | ||||
t) will actually be 7. | ||||
* | ||||
* @see eina_str_split() | * @see eina_str_split() | |||
*/ | */ | |||
EAPI char **eina_str_split_full(const char *string, const char *de limiter, int max_tokens, unsigned int *elements) EINA_ARG_NONNULL(1, 2, 4) EINA_MALLOC EINA_WARN_UNUSED_RESULT; | EAPI char **eina_str_split_full(const char *string, const char *de limiter, int max_tokens, unsigned int *elements) EINA_ARG_NONNULL(1, 2, 4) EINA_MALLOC EINA_WARN_UNUSED_RESULT; | |||
/** | /** | |||
* @brief Join two strings of known length. | * @brief Join two strings of known length. | |||
* | * | |||
* @param dst The buffer to store the result. | * @param dst The buffer to store the result. | |||
* @param size Size (in byte) of the buffer. | * @param size Size (in byte) of the buffer. | |||
* @param sep The separator character to use. | * @param sep The separator character to use. | |||
End of changes. 8 change blocks. | ||||
7 lines changed or deleted | 26 lines changed or added | |||
eina_stringshare.h | eina_stringshare.h | |||
---|---|---|---|---|
skipping to change at line 305 | skipping to change at line 305 | |||
/** | /** | |||
* @brief Note that the given string has lost an instance. | * @brief Note that the given string has lost an instance. | |||
* | * | |||
* @param str string The given string. | * @param str string The given string. | |||
* | * | |||
* This function decreases the reference counter associated to @p str | * This function decreases the reference counter associated to @p str | |||
* if it exists. If that counter reaches 0, the memory associated to | * if it exists. If that counter reaches 0, the memory associated to | |||
* @p str is freed. If @p str is @c NULL, the function returns | * @p str is freed. If @p str is @c NULL, the function returns | |||
* immediately. | * immediately. | |||
* | * | |||
* Note that if the given pointer is not shared or NULL, bad things | * @note If the given pointer is not shared, bad things will happen, likely | |||
* will happen, likely a segmentation fault. | a | |||
* segmentation fault. | ||||
*/ | */ | |||
EAPI void eina_stringshare_del(Eina_Stringshare *str); | EAPI void eina_stringshare_del(Eina_Stringshare *str); | |||
/** | /** | |||
* @brief Note that the given string @b must be shared. | * @brief Note that the given string @b must be shared. | |||
* | * | |||
* @param str the shared string to know the length. It is safe to | * @param str the shared string to know the length. It is safe to | |||
* give @c NULL, in that case @c -1 is returned. | * give @c NULL, in that case @c -1 is returned. | |||
* @return The length of a shared string. | * @return The length of a shared string. | |||
* | * | |||
* This function is a cheap way to known the length of a shared | * This function is a cheap way to known the length of a shared | |||
* string. Note that if the given pointer is not shared, bad | * string. | |||
* things will happen, likely a segmentation fault. If in doubt, try | * | |||
* strlen(). | * @note If the given pointer is not shared, bad things will happen, likely | |||
a | ||||
* segmentation fault. If in doubt, try strlen(). | ||||
*/ | */ | |||
EAPI int eina_stringshare_strlen(Eina_Stringshare *str) EINA _PURE EINA_WARN_UNUSED_RESULT; | EAPI int eina_stringshare_strlen(Eina_Stringshare *str) EINA _PURE EINA_WARN_UNUSED_RESULT; | |||
/** | /** | |||
* @brief Dump the contents of the share_common. | * @brief Dump the contents of the share_common. | |||
* | * | |||
* This function dumps all strings in the share_common to stdout with a | * This function dumps all strings in the share_common to stdout with a | |||
* DDD: prefix per line and a memory usage summary. | * DDD: prefix per line and a memory usage summary. | |||
*/ | */ | |||
EAPI void eina_stringshare_dump(void); | EAPI void eina_stringshare_dump(void); | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 8 lines changed or added | |||
eina_types.h | eina_types.h | |||
---|---|---|---|---|
skipping to change at line 102 | skipping to change at line 102 | |||
#endif | #endif | |||
#ifdef EINA_NOINSTRUMENT | #ifdef EINA_NOINSTRUMENT | |||
# undef EINA_NOINSTRUMENT | # undef EINA_NOINSTRUMENT | |||
#endif | #endif | |||
#ifdef EINA_UNLIKELY | #ifdef EINA_UNLIKELY | |||
# undef EINA_UNLIKELY | # undef EINA_UNLIKELY | |||
#endif | #endif | |||
#ifdef EINA_LIKELY | #ifdef EINA_LIKELY | |||
# undef EINA_LIKELY | # undef EINA_LIKELY | |||
#endif | #endif | |||
#ifdef EINA_SENTINEL | ||||
# undef EINA_SENTINEL | ||||
#endif | ||||
#ifdef __GNUC__ | #ifdef __GNUC__ | |||
# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) | # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) | |||
# define EINA_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) | # define EINA_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) | |||
# else | # else | |||
# define EINA_WARN_UNUSED_RESULT | # define EINA_WARN_UNUSED_RESULT | |||
# endif | # endif | |||
# if (!defined(EINA_SAFETY_CHECKS)) && (__GNUC__ > 3 || (__GNUC__ == 3 && _ _GNUC_MINOR__ >= 3)) | # if (!defined(EINA_SAFETY_CHECKS)) && (__GNUC__ > 3 || (__GNUC__ == 3 && _ _GNUC_MINOR__ >= 3)) | |||
# define EINA_ARG_NONNULL(...) __attribute__ ((__nonnull__(__VA_ARGS__))) | # define EINA_ARG_NONNULL(...) __attribute__ ((__nonnull__(__VA_ARGS__))) | |||
skipping to change at line 142 | skipping to change at line 145 | |||
# define EINA_PRINTF(fmt, arg) __attribute__((__format__ (__gnu_printf__, fmt, arg))) | # define EINA_PRINTF(fmt, arg) __attribute__((__format__ (__gnu_printf__, fmt, arg))) | |||
# else | # else | |||
# define EINA_PRINTF(fmt, arg) __attribute__((__format__ (__printf__, fmt , arg))) | # define EINA_PRINTF(fmt, arg) __attribute__((__format__ (__printf__, fmt , arg))) | |||
# endif | # endif | |||
# define EINA_SCANF(fmt, arg) __attribute__((__format__ (__scanf__, fmt, arg))) | # define EINA_SCANF(fmt, arg) __attribute__((__format__ (__scanf__, fmt, arg))) | |||
# define EINA_FORMAT(fmt) __attribute__((__format_arg__(fmt))) | # define EINA_FORMAT(fmt) __attribute__((__format_arg__(fmt))) | |||
# define EINA_CONST __attribute__((__const__)) | # define EINA_CONST __attribute__((__const__)) | |||
# define EINA_NOINSTRUMENT __attribute__((__no_instrument_function__)) | # define EINA_NOINSTRUMENT __attribute__((__no_instrument_function__)) | |||
# define EINA_UNLIKELY(exp) __builtin_expect((exp), 0) | # define EINA_UNLIKELY(exp) __builtin_expect((exp), 0) | |||
# define EINA_LIKELY(exp) __builtin_expect((exp), 1) | # define EINA_LIKELY(exp) __builtin_expect((exp), 1) | |||
# define EINA_SENTINEL __attribute__((__sentinel__)) | ||||
# else | # else | |||
# define EINA_PRINTF(fmt, arg) | # define EINA_PRINTF(fmt, arg) | |||
# define EINA_SCANF(fmt, arg) | # define EINA_SCANF(fmt, arg) | |||
# define EINA_FORMAT(fmt) | # define EINA_FORMAT(fmt) | |||
# define EINA_CONST | # define EINA_CONST | |||
# define EINA_NOINSTRUMENT | # define EINA_NOINSTRUMENT | |||
# define EINA_UNLIKELY(exp) exp | # define EINA_UNLIKELY(exp) exp | |||
# define EINA_LIKELY(exp) exp | # define EINA_LIKELY(exp) exp | |||
# define EINA_SENTINEL | ||||
# endif | # endif | |||
#elif defined(_WIN32) | #elif defined(_WIN32) | |||
# define EINA_WARN_UNUSED_RESULT | # define EINA_WARN_UNUSED_RESULT | |||
# define EINA_ARG_NONNULL(...) | # define EINA_ARG_NONNULL(...) | |||
# if defined(_MSC_VER) && _MSC_VER >= 1300 | # if defined(_MSC_VER) && _MSC_VER >= 1300 | |||
# define EINA_DEPRECATED __declspec(deprecated) | # define EINA_DEPRECATED __declspec(deprecated) | |||
# else | # else | |||
# define EINA_DEPRECATED | # define EINA_DEPRECATED | |||
# endif | # endif | |||
# define EINA_MALLOC | # define EINA_MALLOC | |||
# define EINA_PURE | # define EINA_PURE | |||
# define EINA_PRINTF(fmt, arg) | # define EINA_PRINTF(fmt, arg) | |||
# define EINA_SCANF(fmt, arg) | # define EINA_SCANF(fmt, arg) | |||
# define EINA_FORMAT(fmt) | # define EINA_FORMAT(fmt) | |||
# define EINA_CONST | # define EINA_CONST | |||
# define EINA_NOINSTRUMENT | # define EINA_NOINSTRUMENT | |||
# define EINA_UNLIKELY(exp) exp | # define EINA_UNLIKELY(exp) exp | |||
# define EINA_LIKELY(exp) exp | # define EINA_LIKELY(exp) exp | |||
# define EINA_SENTINEL | ||||
#elif defined(__SUNPRO_C) | #elif defined(__SUNPRO_C) | |||
# define EINA_WARN_UNUSED_RESULT | # define EINA_WARN_UNUSED_RESULT | |||
# define EINA_ARG_NONNULL(...) | # define EINA_ARG_NONNULL(...) | |||
# define EINA_DEPRECATED | # define EINA_DEPRECATED | |||
# if __SUNPRO_C >= 0x590 | # if __SUNPRO_C >= 0x590 | |||
# define EINA_MALLOC __attribute__ ((malloc)) | # define EINA_MALLOC __attribute__ ((malloc)) | |||
# define EINA_PURE __attribute__ ((pure)) | # define EINA_PURE __attribute__ ((pure)) | |||
# else | # else | |||
# define EINA_MALLOC | # define EINA_MALLOC | |||
skipping to change at line 192 | skipping to change at line 198 | |||
# define EINA_SCANF(fmt, arg) | # define EINA_SCANF(fmt, arg) | |||
# define EINA_FORMAT(fmt) | # define EINA_FORMAT(fmt) | |||
# if __SUNPRO_C >= 0x590 | # if __SUNPRO_C >= 0x590 | |||
# define EINA_CONST __attribute__ ((const)) | # define EINA_CONST __attribute__ ((const)) | |||
# else | # else | |||
# define EINA_CONST | # define EINA_CONST | |||
# endif | # endif | |||
# define EINA_NOINSTRUMENT | # define EINA_NOINSTRUMENT | |||
# define EINA_UNLIKELY(exp) exp | # define EINA_UNLIKELY(exp) exp | |||
# define EINA_LIKELY(exp) exp | # define EINA_LIKELY(exp) exp | |||
# define EINA_SENTINEL | ||||
#else /* ! __GNUC__ && ! _WIN32 && ! __SUNPRO_C */ | #else /* ! __GNUC__ && ! _WIN32 && ! __SUNPRO_C */ | |||
/** | /** | |||
* @def EINA_WARN_UNUSED_RESULT | * @def EINA_WARN_UNUSED_RESULT | |||
* Used to warn when the returned value of the function is not used. | * Used to warn when the returned value of the function is not used. | |||
*/ | */ | |||
# define EINA_WARN_UNUSED_RESULT | # define EINA_WARN_UNUSED_RESULT | |||
/** | /** | |||
skipping to change at line 263 | skipping to change at line 270 | |||
/** | /** | |||
* @def EINA_UNLIKELY | * @def EINA_UNLIKELY | |||
* @param exp The expression to be used. | * @param exp The expression to be used. | |||
*/ | */ | |||
# define EINA_UNLIKELY(exp) exp | # define EINA_UNLIKELY(exp) exp | |||
/** | /** | |||
* @def EINA_LIKELY | * @def EINA_LIKELY | |||
* @param exp The expression to be used. | * @param exp The expression to be used. | |||
*/ | */ | |||
# define EINA_LIKELY(exp) exp | # define EINA_LIKELY(exp) exp | |||
/** | ||||
* @def EINA_SENTINEL | ||||
* @brief Attribute from gcc to prevent calls without the necessary NULL | ||||
* sentinel in certain variadic functions | ||||
* @since 1.7.0 | ||||
*/ | ||||
# define EINA_SENTINEL | ||||
#endif /* ! __GNUC__ && ! _WIN32 && ! __SUNPRO_C */ | #endif /* ! __GNUC__ && ! _WIN32 && ! __SUNPRO_C */ | |||
/** | /** | |||
* @typedef Eina_Bool | * @typedef Eina_Bool | |||
* Type to mimic a boolean. | * Type to mimic a boolean. | |||
* | * | |||
* @note it differs from stdbool.h as this is defined as an unsigned | * @note it differs from stdbool.h as this is defined as an unsigned | |||
* char to make it usable by bitfields (Eina_Bool name:1) and | * char to make it usable by bitfields (Eina_Bool name:1) and | |||
* also take as few bytes as possible. | * also take as few bytes as possible. | |||
*/ | */ | |||
End of changes. 6 change blocks. | ||||
0 lines changed or deleted | 14 lines changed or added | |||
eina_ustringshare.h | eina_ustringshare.h | |||
---|---|---|---|---|
skipping to change at line 160 | skipping to change at line 160 | |||
/** | /** | |||
* @brief Note that the given string has lost an instance. | * @brief Note that the given string has lost an instance. | |||
* | * | |||
* @param str string The given string. | * @param str string The given string. | |||
* | * | |||
* This function decreases the reference counter associated to @p str | * This function decreases the reference counter associated to @p str | |||
* if it exists. If that counter reaches 0, the memory associated to | * if it exists. If that counter reaches 0, the memory associated to | |||
* @p str is freed. If @p str is @c NULL, the function returns | * @p str is freed. If @p str is @c NULL, the function returns | |||
* immediately. | * immediately. | |||
* | * | |||
* Note that if the given pointer is not shared or @c NULL, bad things | * @note If the given pointer is not shared, bad things will happen, likely | |||
* will happen, likely a segmentation fault. | a | |||
* segmentation fault. | ||||
*/ | */ | |||
EAPI void eina_ustringshare_del(const Eina_Unicode *str); | EAPI void eina_ustringshare_del(const Eina_Unicode *str); | |||
/** | /** | |||
* @brief Note that the given string @b must be shared. | * @brief Note that the given string @b must be shared. | |||
* | * | |||
* @param str the shared string to know the length. It is safe to | * @param str the shared string to know the length. It is safe to | |||
* give @c NULL, in that case @c -1 is returned. | * give @c NULL, in that case @c -1 is returned. | |||
* | * | |||
* This function is a cheap way to known the length of a shared | * This function is a cheap way to known the length of a shared | |||
* string. Note that if the given pointer is not shared, bad | * string. | |||
* things will happen, likely a segmentation fault. If in doubt, try | * | |||
* strlen(). | * @note If the given pointer is not shared, bad things will happen, likely | |||
a | ||||
* segmentation fault. If in doubt, try strlen(). | ||||
*/ | */ | |||
EAPI int eina_ustringshare_strlen(const Eina_Unicode *str) EINA_PURE EINA_WARN_UNUSED_RESULT; | EAPI int eina_ustringshare_strlen(const Eina_Unicode *str) EINA_PURE EINA_WARN_UNUSED_RESULT; | |||
/** | /** | |||
* @brief Dump the contents of the share_common. | * @brief Dump the contents of the share_common. | |||
* | * | |||
* This function dumps all strings in the share_common to stdout with a | * This function dumps all strings in the share_common to stdout with a | |||
* DDD: prefix per line and a memory usage summary. | * DDD: prefix per line and a memory usage summary. | |||
*/ | */ | |||
EAPI void eina_ustringshare_dump(void); | EAPI void eina_ustringshare_dump(void); | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 8 lines changed or added | |||