/**
* @page tutorial_array_page Array Tutorial
*
- * to be written...
+ * The Array data type is allow the storage of data like a C array.
+ * It is designed such that the access to its element is very fast.
+ * But the addition or removal can be done only at the end of the
+ * array. To add or remove an element at any location, the Eina
+ * @ref Eina_List_Group is the correct container is the correct one.
*
+ * @section tutorial_error_basic_usage Basic Usage
+ *
+ * The first thing to do when using arrays is to initialize the array
+ * module with eina_array_init() and, when no more arrays are used, the
+ * module is shut down with eina_array_shutdown(). So a basic program
+ * would look like that:
+ *
+ * @code
+ * #include <stdlib.h>
+ * #include <stdio.h>
+ *
+ * #include <eina_array.h>
+ *
+ * int main(void)
+ * {
+ * if (!eina_array_init())
+ * {
+ * printf ("Error during the initialization of eina_error module\n");
+ * return EXIT_FAILURE;
+ * }
+ *
+ * eina_array_shutdown();
+ *
+ * return EXIT_SUCCESS;
+ * }
+ * @endcode
+ *
+ * All program using any module of eina must be compiled with the
+ * following command:
+ *
+ * @code
+ * gcc -Wall -o my_exe my_source.c `pkg-config --cflags --libs eina`
+ * @endcode
+ *
+ * Then, an array must created with eina_array_new().
+ *
+ * To be continued
*/
#ifdef HAVE_CONFIG_H
*
* @brief These functions provide array management.
*
+ * The Array data type in Eina is designed to have a very fast access to
+ * its data (compared to the Eina @ref Eina_List_Group). On the other hand,
+ * data can be added or removed only at the end of the array. To insert
+ * data at any place, he Eina @ref Eina_List_Group is the correct container
+ * to use.
+ *
* To use the array data type, eina_array_init() must be called before
* any other array functions. When no more array function is used,
* eina_array_shutdown() must be called to free all the resources.
Eina_Run *run;
char *buffer;
Eina_Bool first = EINA_FALSE;
- int length;
+ size_t length;
if (!bench) return NULL;
{
Eina_Counter *counter;
char *result;
- int tmp;
+ size_t tmp;
int i;
tmp = strlen(EINA_BENCHMARK_DATA_MASK) + strlen(bench->name) + strlen(bench->run) + strlen(run->name);
eina_counter_add(const char *name)
{
Eina_Counter *counter;
- int length;
+ size_t length;
EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
EAPI Eina_Error eina_error_msg_register(const char *msg)
{
Eina_Inlist *tmp;
- int length;
+ size_t length;
EINA_SAFETY_ON_NULL_RETURN_VAL(msg, 0);
HANDLE hSearch;
char *new_dir;
TCHAR *tdir;
- int length_dir;
+ size_t length_dir;
length_dir = strlen(dir);
new_dir = (char *)alloca(length_dir + 5);
{
Eina_Array *ea;
char *current;
- int length;
+ size_t length;
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
_eina_string_key_length(const char *key)
{
if (!key) return 0;
- return strlen(key) + 1;
+ return (int)strlen(key) + 1;
}
static int
# include "config.h"
#endif
-#include "Eina.h"
+#include "eina_types.h"
+#include "eina_main.h"
+#include "eina_error.h"
+#include "eina_hash.h"
+#include "eina_stringshare.h"
+#include "eina_list.h"
+#include "eina_array.h"
+#include "eina_counter.h"
+#include "eina_benchmark.h"
+#include "eina_magic.h"
/*============================================================================*
* Global *
}
/**
- *
+ *
*/
EAPI Eina_Mempool *
eina_mempool_new(const char *name, const char *context, const char *options, ...)
}
/**
- *
+ *
*/
EAPI void eina_mempool_delete(Eina_Mempool *mp)
{
static void _dir_list_cb(const char *name, const char *path, void *data)
{
Dir_List_Cb_Data *cb_data = data;
- unsigned int length;
+ size_t length;
length = strlen(name);
if (length < strlen(MODULE_EXTENSION) + 1) /* x.so */
{
char *file;
Eina_Module *m;
- int length;
+ size_t length;
length = strlen(path) + strlen(name) + 2;
env_dir = getenv(env);
if (env_dir)
{
- char *path;
- int l1;
- int l2 = 0;
+ char *path;
+ size_t l1;
+ size_t l2 = 0;
l1 = strlen(env_dir);
if (sub_dir && (*sub_dir != '\0'))
_eina_stringshare_head_alloc(int slen)
{
Eina_Stringshare_Head *head, t;
- const unsigned int head_size = (char *)&(t.builtin_node.str) - (char *)&t;
+ const size_t head_size = (char *)&(t.builtin_node.str) - (char *)&t;
head = malloc(head_size + slen);
if (!head)
_eina_stringshare_node_alloc(int slen)
{
Eina_Stringshare_Node *node, t;
- const unsigned int node_size = (char *)&(t.str) - (char *)&t;
+ const size_t node_size = (char *)&(t.str) - (char *)&t;
node = malloc(node_size + slen);
if (!node)
else if (str[1] == '\0') slen = 1;
else if (str[2] == '\0') slen = 2;
else if (str[3] == '\0') slen = 3;
- else slen = 3 + strlen(str + 3);
+ else slen = 3 + (int)strlen(str + 3);
_eina_stringshare_population_add(slen);
_eina_stringshare_node_from_str(const char *str)
{
Eina_Stringshare_Node *node, t;
- const unsigned int offset = (char *)&(t.str) - (char *)&t;
+ const size_t offset = (char *)&(t.str) - (char *)&t;
node = (Eina_Stringshare_Node *)(str - offset);
EINA_MAGIC_CHECK_STRINGSHARE_NODE(node);