* minor formatting

* add some doc in eina_array
 * in eina_main.c, include only the necessary headers
 * fix some warnings (size_t <-> int)


SVN revision: 38740
This commit is contained in:
Vincent Torri 2009-01-23 16:11:45 +00:00
parent b814a5e2be
commit c166854ae1
10 changed files with 76 additions and 20 deletions

View File

@ -23,8 +23,49 @@
/**
* @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
@ -192,6 +233,12 @@ eina_array_grow(Eina_Array *array)
*
* @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.

View File

@ -319,7 +319,7 @@ eina_benchmark_run(Eina_Benchmark *bench)
Eina_Run *run;
char *buffer;
Eina_Bool first = EINA_FALSE;
int length;
size_t length;
if (!bench) return NULL;
@ -360,7 +360,7 @@ eina_benchmark_run(Eina_Benchmark *bench)
{
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);

View File

@ -300,7 +300,7 @@ EAPI Eina_Counter *
eina_counter_add(const char *name)
{
Eina_Counter *counter;
int length;
size_t length;
EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);

View File

@ -587,7 +587,7 @@ EAPI int eina_error_shutdown(void)
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);

View File

@ -167,7 +167,7 @@ eina_file_dir_list(const char *dir, Eina_Bool recursive, Eina_File_Dir_List_Cb c
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);
@ -246,7 +246,7 @@ eina_file_split(char *path)
{
Eina_Array *ea;
char *current;
int length;
size_t length;
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);

View File

@ -425,7 +425,7 @@ static unsigned int
_eina_string_key_length(const char *key)
{
if (!key) return 0;
return strlen(key) + 1;
return (int)strlen(key) + 1;
}
static int

View File

@ -20,7 +20,16 @@
# 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 *

View File

@ -198,7 +198,7 @@ eina_mempool_shutdown(void)
}
/**
*
*
*/
EAPI Eina_Mempool *
eina_mempool_new(const char *name, const char *context, const char *options, ...)
@ -216,7 +216,7 @@ eina_mempool_new(const char *name, const char *context, const char *options, ...
}
/**
*
*
*/
EAPI void eina_mempool_delete(Eina_Mempool *mp)
{

View File

@ -117,7 +117,7 @@ static Eina_Bool _dir_list_get_cb(Eina_Module *m, void *data)
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 */
@ -127,7 +127,7 @@ static void _dir_list_cb(const char *name, const char *path, void *data)
{
char *file;
Eina_Module *m;
int length;
size_t length;
length = strlen(path) + strlen(name) + 2;
@ -354,9 +354,9 @@ EAPI char *eina_module_environment_path_get(const char *env, const char *sub_dir
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'))

View File

@ -638,7 +638,7 @@ static Eina_Stringshare_Head *
_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)
@ -751,7 +751,7 @@ static Eina_Stringshare_Node *
_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)
@ -907,7 +907,7 @@ eina_stringshare_add(const char *str)
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);
@ -955,7 +955,7 @@ static Eina_Stringshare_Node *
_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);