* eina: attempt to improve a little bit more the header.

Mainly trailing space and macro indentation.


SVN revision: 51217
This commit is contained in:
Cedric BAIL 2010-08-16 15:02:37 +00:00
parent 6293bd87fa
commit c45c36bd80
11 changed files with 237 additions and 242 deletions

View File

@ -54,16 +54,15 @@ EAPI extern Eina_Error EINA_ERROR_CONVERT_0X_NOT_FOUND;
*/ */
EAPI extern Eina_Error EINA_ERROR_CONVERT_OUTRUN_STRING_LENGTH; EAPI extern Eina_Error EINA_ERROR_CONVERT_OUTRUN_STRING_LENGTH;
EAPI int eina_convert_itoa(int n, EAPI int eina_convert_itoa(int n, char *s) EINA_ARG_NONNULL(2);
char *s) EINA_ARG_NONNULL(2); EAPI int eina_convert_xtoa(unsigned int n, char *s) EINA_ARG_NONNULL(2);
EAPI int eina_convert_xtoa(unsigned int n,
char *s) EINA_ARG_NONNULL(2); EAPI int eina_convert_dtoa(double d, char *des) EINA_ARG_NONNULL(2);
EAPI int eina_convert_dtoa(double d,
char *des) EINA_ARG_NONNULL(2);
EAPI Eina_Bool eina_convert_atod(const char *src, EAPI Eina_Bool eina_convert_atod(const char *src,
int length, int length,
long long *m, long long *m,
long *e) EINA_ARG_NONNULL(1,3,4); long *e) EINA_ARG_NONNULL(1,3,4);
EAPI int eina_convert_fptoa(Eina_F32p32 fp, EAPI int eina_convert_fptoa(Eina_F32p32 fp,
char *des) EINA_ARG_NONNULL(2); char *des) EINA_ARG_NONNULL(2);
EAPI Eina_Bool eina_convert_atofp(const char *src, EAPI Eina_Bool eina_convert_atofp(const char *src,

View File

@ -47,6 +47,28 @@ eina_strlen_bounded(const char *str, size_t maxlen)
return itr - str; return itr - str;
} }
/**
* @brief Join two strings of known length.
*
* @param dst The buffer to store the result.
* @param size Size (in byte) of the buffer.
* @param sep The separator character to use.
* @param a First string to use, before @p sep.
* @param b Second string to use, after @p sep.
* @return The number of characters printed.
*
* This function is similar to eina_str_join_len(), but will compute
* the length of @p a and @p b using strlen().
*
* @see eina_str_join_len()
* @see eina_str_join_static()
*/
static inline size_t
eina_str_join(char *dst, size_t size, char sep, const char *a, const char *b)
{
return eina_str_join_len(dst, size, sep, a, strlen(a), b, strlen(b));
}
/** /**
* @} * @}
*/ */

View File

@ -156,11 +156,12 @@ EAPI Eina_Accessor * eina_list_accessor_new(const Eina_List *list)
* For destructive operations such as this, consider * For destructive operations such as this, consider
* using EINA_LIST_FOREACH_SAFE(). * using EINA_LIST_FOREACH_SAFE().
*/ */
#define EINA_LIST_FOREACH(list, l, data) for (l = list, \ #define EINA_LIST_FOREACH(list, l, data) \
for (l = list, \
data = eina_list_data_get(l); \ data = eina_list_data_get(l); \
l; \ l; \
l = eina_list_next(l), data = \ l = eina_list_next(l), \
eina_list_data_get(l)) data = eina_list_data_get(l))
/** /**
* @def EINA_LIST_REVERSE_FOREACH * @def EINA_LIST_REVERSE_FOREACH
@ -203,13 +204,12 @@ EAPI Eina_Accessor * eina_list_accessor_new(const Eina_List *list)
* For destructive operations such as this, consider * For destructive operations such as this, consider
* using EINA_LIST_REVERSE_FOREACH_SAFE(). * using EINA_LIST_REVERSE_FOREACH_SAFE().
*/ */
#define EINA_LIST_REVERSE_FOREACH(list, l, data) for (l = eina_list_last(list), \ #define EINA_LIST_REVERSE_FOREACH(list, l, data) \
data = \ for (l = eina_list_last(list), \
eina_list_data_get(l); \ data = eina_list_data_get(l); \
l; \ l; \
l = eina_list_prev(l), \ l = eina_list_prev(l), \
data = \ data = eina_list_data_get(l))
eina_list_data_get(l))
/** /**
* @def EINA_LIST_FOREACH_SAFE * @def EINA_LIST_FOREACH_SAFE
@ -246,16 +246,14 @@ EAPI Eina_Accessor * eina_list_accessor_new(const Eina_List *list)
* } * }
* @endcode * @endcode
*/ */
#define EINA_LIST_FOREACH_SAFE(list, l, l_next, data) for (l = list, \ #define EINA_LIST_FOREACH_SAFE(list, l, l_next, data) \
l_next = \ for (l = list, \
eina_list_next(l), \ l_next = eina_list_next(l), \
data = \ data = eina_list_data_get(l); \
eina_list_data_get(l); \
l; \ l; \
l = l_next, l_next = \ l = l_next, \
eina_list_next(l), \ l_next = eina_list_next(l), \
data = \ data = eina_list_data_get(l))
eina_list_data_get(l))
/** /**
* @def EINA_LIST_REVERSE_FOREACH_SAFE * @def EINA_LIST_REVERSE_FOREACH_SAFE
@ -294,18 +292,14 @@ EAPI Eina_Accessor * eina_list_accessor_new(const Eina_List *list)
* } * }
* @endcode * @endcode
*/ */
#define EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, data) for (l = \ #define EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, data) \
eina_list_last(list), \ for (l = eina_list_last(list), \
l_prev = \ l_prev = eina_list_prev(l), \
eina_list_prev(l), \ data = eina_list_data_get(l); \
data = \
eina_list_data_get(l); \
l; \ l; \
l = l_prev, \ l = l_prev, \
l_prev = \ l_prev = eina_list_prev(l), \
eina_list_prev(l), \ data = eina_list_data_get(l))
data = \
eina_list_data_get(l))
/** /**
* @def EINA_LIST_FREE * @def EINA_LIST_FREE
@ -332,11 +326,11 @@ EAPI Eina_Accessor * eina_list_accessor_new(const Eina_List *list)
* *
* @see eina_list_free() * @see eina_list_free()
*/ */
#define EINA_LIST_FREE(list, data) for (data = eina_list_data_get(list); list; \ #define EINA_LIST_FREE(list, data) \
list = \ for (data = eina_list_data_get(list); \
eina_list_remove_list(list, \ list; \
list), data = \ list = eina_list_remove_list(list, list), \
eina_list_data_get(list)) data = eina_list_data_get(list))
#include "eina_inline_list.x" #include "eina_inline_list.x"

View File

@ -111,7 +111,8 @@ EAPI Eina_Bool eina_magic_string_static_set(Eina_Magic magic,
* If the magic feature of Eina is disabled, #EINA_MAGIC_FAIL does * If the magic feature of Eina is disabled, #EINA_MAGIC_FAIL does
* nothing. * nothing.
*/ */
#define EINA_MAGIC_FAIL(d, m) eina_magic_fail((void *)(d), \ #define EINA_MAGIC_FAIL(d, m) \
eina_magic_fail((void *)(d), \
(d) ? (d)->__magic : 0, \ (d) ? (d)->__magic : 0, \
(m), \ (m), \
__FILE__, \ __FILE__, \

View File

@ -40,27 +40,6 @@ EAPI void eina_str_toupper(char **str);
static inline size_t eina_str_join(char *dst, size_t size, char sep, const char *a, const char *b) EINA_ARG_NONNULL(1, 4, 5); static inline size_t eina_str_join(char *dst, size_t size, char sep, const char *a, const char *b) EINA_ARG_NONNULL(1, 4, 5);
/**
* @brief Join two strings of known length.
*
* @param dst The buffer to store the result.
* @param size Size (in byte) of the buffer.
* @param sep The separator character to use.
* @param a First string to use, before @p sep.
* @param b Second string to use, after @p sep.
* @return The number of characters printed.
*
* This function is similar to eina_str_join_len(), but will compute
* the length of @p a and @p b using strlen().
*
* @see eina_str_join_len()
* @see eina_str_join_static()
*/
static inline size_t eina_str_join(char *dst, size_t size, char sep, const char *a, const char *b)
{
return eina_str_join_len(dst, size, sep, a, strlen(a), b, strlen(b));
}
/** /**
* @def eina_str_join_static(dst, sep, a, b) * @def eina_str_join_static(dst, sep, a, b)
* @brief Join two static strings and store the result in a static buffer. * @brief Join two static strings and store the result in a static buffer.