#define FUNC_ACCESSOR_LOCK(Function) ((Eina_Accessor_Lock_Callback)Function)
EAPI void eina_accessor_free(Eina_Accessor *accessor) EINA_ARG_NONNULL(1);
-EAPI Eina_Bool eina_accessor_data_get(Eina_Accessor *accessor,
- unsigned int position,
+EAPI Eina_Bool eina_accessor_data_get(Eina_Accessor *accessor,
+ unsigned int position,
void **data) EINA_ARG_NONNULL(1);
EAPI void * eina_accessor_container_get(Eina_Accessor *accessor) EINA_ARG_NONNULL(1) EINA_PURE;
-EAPI void eina_accessor_over(Eina_Accessor *accessor,
- Eina_Each_Cb cb,
- unsigned int start,
- unsigned int end,
+EAPI void eina_accessor_over(Eina_Accessor *accessor,
+ Eina_Each_Cb cb,
+ unsigned int start,
+ unsigned int end,
const void *fdata) EINA_ARG_NONNULL(1, 2);
EAPI Eina_Bool eina_accessor_lock(Eina_Accessor *accessor) EINA_ARG_NONNULL(1);
EAPI Eina_Bool eina_accessor_unlock(Eina_Accessor *accessor) EINA_ARG_NONNULL(1);
* rather in the accessors implementations to keep them as simple
* and fast as possible.
*/
-#define EINA_ACCESSOR_FOREACH(accessor, counter, data) \
- for ((counter) = 0; \
- eina_accessor_data_get((accessor), (counter), (void **)&(data)); \
- (counter)++)
+#define EINA_ACCESSOR_FOREACH(accessor, counter, data) \
+ for ((counter) = 0; \
+ eina_accessor_data_get((accessor), (counter), (void **)&(data)); \
+ (counter)++)
/**
* @}
unsigned int step) EINA_ARG_NONNULL(1);
EAPI void eina_array_clean(Eina_Array *array) EINA_ARG_NONNULL(1);
EAPI void eina_array_flush(Eina_Array *array) EINA_ARG_NONNULL(1);
-EAPI Eina_Bool eina_array_remove(Eina_Array *array,
- Eina_Bool(*keep)(void *data, void *gdata),
+EAPI Eina_Bool eina_array_remove(Eina_Array *array,
+ Eina_Bool(*keep)(void *data, void *gdata),
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);
static inline void * eina_array_pop(Eina_Array *array) EINA_ARG_NONNULL(1);
static inline void * eina_array_data_get(const Eina_Array *array,
unsigned int idx) EINA_ARG_NONNULL(1);
static inline void eina_array_data_set(const Eina_Array *array,
- unsigned int idx,
+ unsigned int idx,
const void *data) EINA_ARG_NONNULL(1, 3);
static inline unsigned int eina_array_count_get(const Eina_Array *array) EINA_ARG_NONNULL(1);
EAPI Eina_Iterator * eina_array_iterator_new(const Eina_Array *array) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
* free(item);
* @endcode
*/
-#define EINA_ARRAY_ITER_NEXT(array, index, item, iterator) \
- for (index = 0, iterator = (array)->data; \
- (index < eina_array_count_get(array)) && ((item = *((iterator)++))); \
- ++(index))
+#define EINA_ARRAY_ITER_NEXT(array, index, item, iterator) \
+ for (index = 0, iterator = (array)->data; \
+ (index < eina_array_count_get(array)) && ((item = *((iterator)++))); \
+ ++(index))
#include "eina_inline_array.x"
*/
EAPI extern Eina_Error EINA_ERROR_CONVERT_OUTRUN_STRING_LENGTH;
-EAPI int eina_convert_itoa(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_itoa(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 Eina_Bool eina_convert_atod(const char *src,
int length,
long long *m,
long *e) EINA_ARG_NONNULL(1,3,4);
+
EAPI int eina_convert_fptoa(Eina_F32p32 fp,
char *des) EINA_ARG_NONNULL(2);
EAPI Eina_Bool eina_convert_atofp(const char *src,
}
/**
+ * @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));
+}
+
+/**
* @}
*/
* For destructive operations such as this, consider
* using EINA_LIST_FOREACH_SAFE().
*/
-#define EINA_LIST_FOREACH(list, l, data) for (l = list, \
- data = eina_list_data_get(l); \
- l; \
- l = eina_list_next(l), data = \
- eina_list_data_get(l))
+#define EINA_LIST_FOREACH(list, l, data) \
+ for (l = list, \
+ data = eina_list_data_get(l); \
+ l; \
+ l = eina_list_next(l), \
+ data = eina_list_data_get(l))
/**
* @def EINA_LIST_REVERSE_FOREACH
* For destructive operations such as this, consider
* using EINA_LIST_REVERSE_FOREACH_SAFE().
*/
-#define EINA_LIST_REVERSE_FOREACH(list, l, data) for (l = eina_list_last(list), \
- data = \
- eina_list_data_get(l); \
- l; \
- l = eina_list_prev(l), \
- data = \
- eina_list_data_get(l))
+#define EINA_LIST_REVERSE_FOREACH(list, l, data) \
+ for (l = eina_list_last(list), \
+ data = eina_list_data_get(l); \
+ l; \
+ l = eina_list_prev(l), \
+ data = eina_list_data_get(l))
/**
* @def EINA_LIST_FOREACH_SAFE
* }
* @endcode
*/
-#define EINA_LIST_FOREACH_SAFE(list, l, l_next, data) for (l = list, \
- l_next = \
- eina_list_next(l), \
- data = \
- eina_list_data_get(l); \
- l; \
- l = l_next, l_next = \
- eina_list_next(l), \
- data = \
- eina_list_data_get(l))
+#define EINA_LIST_FOREACH_SAFE(list, l, l_next, data) \
+ for (l = list, \
+ l_next = eina_list_next(l), \
+ data = eina_list_data_get(l); \
+ l; \
+ l = l_next, \
+ l_next = eina_list_next(l), \
+ data = eina_list_data_get(l))
/**
* @def EINA_LIST_REVERSE_FOREACH_SAFE
* }
* @endcode
*/
-#define EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, data) for (l = \
- eina_list_last(list), \
- l_prev = \
- eina_list_prev(l), \
- data = \
- eina_list_data_get(l); \
- l; \
- l = l_prev, \
- l_prev = \
- eina_list_prev(l), \
- data = \
- eina_list_data_get(l))
+#define EINA_LIST_REVERSE_FOREACH_SAFE(list, l, l_prev, data) \
+ for (l = eina_list_last(list), \
+ l_prev = eina_list_prev(l), \
+ data = eina_list_data_get(l); \
+ l; \
+ l = l_prev, \
+ l_prev = eina_list_prev(l), \
+ data = eina_list_data_get(l))
/**
* @def EINA_LIST_FREE
*
* @see eina_list_free()
*/
-#define EINA_LIST_FREE(list, data) for (data = eina_list_data_get(list); list; \
- list = \
- eina_list_remove_list(list, \
- list), data = \
- eina_list_data_get(list))
+#define EINA_LIST_FREE(list, data) \
+ for (data = eina_list_data_get(list); \
+ list; \
+ list = eina_list_remove_list(list, list), \
+ data = eina_list_data_get(list))
#include "eina_inline_list.x"
*/
#ifdef EINA_LOG_LEVEL_MAXIMUM
#define EINA_LOG(DOM, LEVEL, fmt, ...) \
- do { \
- if (LEVEL <= EINA_LOG_LEVEL_MAXIMUM) { \
- eina_log_print(DOM, LEVEL, __FILE__, __FUNCTION__, __LINE__, \
- fmt, ## __VA_ARGS__); } \
- } while (0)
+ do { \
+ if (LEVEL <= EINA_LOG_LEVEL_MAXIMUM) { \
+ eina_log_print(DOM, LEVEL, __FILE__, __FUNCTION__, __LINE__, \
+ fmt, ## __VA_ARGS__); } \
+ } while (0)
#else
-#define EINA_LOG(DOM, LEVEL, fmt, ...) \
- eina_log_print(DOM, \
- LEVEL, \
- __FILE__, \
- __FUNCTION__, \
- __LINE__, \
- fmt, \
- ## __VA_ARGS__)
+#define EINA_LOG(DOM, LEVEL, fmt, ...) \
+ eina_log_print(DOM, \
+ LEVEL, \
+ __FILE__, \
+ __FUNCTION__, \
+ __LINE__, \
+ fmt, \
+ ## __VA_ARGS__)
#endif
/**
* Logs a message with level CRITICAL on the default domain with the specified
* format.
*/
-#define EINA_LOG_CRIT(fmt, ...) \
+#define EINA_LOG_CRIT(fmt, ...) \
EINA_LOG(EINA_LOG_DOMAIN_DEFAULT, \
EINA_LOG_LEVEL_CRITICAL, \
- fmt, \
+ fmt, \
## __VA_ARGS__)
/**
* If the magic feature of Eina is disabled, #EINA_MAGIC_FAIL does
* nothing.
*/
-#define EINA_MAGIC_FAIL(d, m) eina_magic_fail((void *)(d), \
- (d) ? (d)->__magic : 0, \
- (m), \
- __FILE__, \
- __FUNCTION__, \
- __LINE__);
+#define EINA_MAGIC_FAIL(d, m) \
+ eina_magic_fail((void *)(d), \
+ (d) ? (d)->__magic : 0, \
+ (m), \
+ __FILE__, \
+ __FUNCTION__, \
+ __LINE__);
EAPI void eina_magic_fail(void *d, Eina_Magic m, Eina_Magic req_m,
const char *file, const char *fnc,
/* undef the following, we want out version */
#undef FREE
-#define FREE(ptr) \
- do { \
- free(ptr); \
- ptr = NULL; \
- } while(0);
+#define FREE(ptr) \
+ do { \
+ free(ptr); \
+ ptr = NULL; \
+ } while(0);
#undef IF_FREE
-#define IF_FREE(ptr) \
- do { \
- if (ptr) { \
- free(ptr); \
- ptr = NULL; \
- } \
- } while(0);
+#define IF_FREE(ptr) \
+ do { \
+ if (ptr) { \
+ free(ptr); \
+ ptr = NULL; \
+ } \
+ } while(0);
#undef IF_FN_DEL
-#define IF_FN_DEL(_fn, ptr) \
- do { \
- if (ptr) { \
- _fn(ptr); \
- ptr = NULL; \
- } \
- } while(0);
-
-#define MAGIC_FREE(ptr) \
- do { \
- if (ptr) { \
- EINA_MAGIC_SET(ptr, EINA_MAGIC_NONE); \
- FREE(ptr); \
- } \
- } while(0);
+#define IF_FN_DEL(_fn, ptr) \
+ do { \
+ if (ptr) { \
+ _fn(ptr); \
+ ptr = NULL; \
+ } \
+ } while(0);
+
+#define MAGIC_FREE(ptr) \
+ do { \
+ if (ptr) { \
+ EINA_MAGIC_SET(ptr, EINA_MAGIC_NONE); \
+ FREE(ptr); \
+ } \
+ } while(0);
#ifdef EFL_HAVE_THREADS
void eina_share_common_threads_init(void);
* width and @p H is its height.
*/
#define EINA_RECTANGLE_SET(Rectangle, X, Y, W, H) \
- (Rectangle)->x = X; \
- (Rectangle)->y = Y; \
- (Rectangle)->w = W; \
+ (Rectangle)->x = X; \
+ (Rectangle)->y = Y; \
+ (Rectangle)->w = W; \
(Rectangle)->h = H;
EAPI Eina_Rectangle *eina_rectangle_new(int x, int y, int w, int h) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
#include "eina_log.h"
#define EINA_SAFETY_ON_NULL_RETURN(exp) \
- do \
- { \
- if (EINA_UNLIKELY((exp) == NULL)) \
- { \
- eina_error_set(EINA_ERROR_SAFETY_FAILED); \
- EINA_LOG_ERR("%s", "safety check failed: " # exp " == NULL"); \
- return; \
- } \
- } \
- while (0)
+ do \
+ { \
+ if (EINA_UNLIKELY((exp) == NULL)) \
+ { \
+ eina_error_set(EINA_ERROR_SAFETY_FAILED); \
+ EINA_LOG_ERR("%s", "safety check failed: " # exp " == NULL"); \
+ return; \
+ } \
+ } \
+ while (0)
#define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val) \
- do \
- { \
- if (EINA_UNLIKELY((exp) == NULL)) \
- { \
- eina_error_set(EINA_ERROR_SAFETY_FAILED); \
- EINA_LOG_ERR("%s", "safety check failed: " # exp " == NULL"); \
- return (val); \
- } \
- } \
- while (0)
+ do \
+ { \
+ if (EINA_UNLIKELY((exp) == NULL)) \
+ { \
+ eina_error_set(EINA_ERROR_SAFETY_FAILED); \
+ EINA_LOG_ERR("%s", "safety check failed: " # exp " == NULL"); \
+ return (val); \
+ } \
+ } \
+ while (0)
#define EINA_SAFETY_ON_NULL_GOTO(exp, label) \
- do \
- { \
- if (EINA_UNLIKELY((exp) == NULL)) \
- { \
- eina_error_set(EINA_ERROR_SAFETY_FAILED); \
- EINA_LOG_ERR("%s", "safety check failed: " # exp " == NULL"); \
- goto label; \
- } \
- } \
- while (0)
+ do \
+ { \
+ if (EINA_UNLIKELY((exp) == NULL)) \
+ { \
+ eina_error_set(EINA_ERROR_SAFETY_FAILED); \
+ EINA_LOG_ERR("%s", "safety check failed: " # exp " == NULL"); \
+ goto label; \
+ } \
+ } \
+ while (0)
#define EINA_SAFETY_ON_TRUE_RETURN(exp) \
- do \
- { \
- if (EINA_UNLIKELY(exp)) \
- { \
- eina_error_set(EINA_ERROR_SAFETY_FAILED); \
- EINA_LOG_ERR("%s", "safety check failed: " # exp " is true"); \
- return; \
- } \
- } \
- while (0)
+ do \
+ { \
+ if (EINA_UNLIKELY(exp)) \
+ { \
+ eina_error_set(EINA_ERROR_SAFETY_FAILED); \
+ EINA_LOG_ERR("%s", "safety check failed: " # exp " is true"); \
+ return; \
+ } \
+ } \
+ while (0)
#define EINA_SAFETY_ON_TRUE_RETURN_VAL(exp, val) \
- do \
- { \
- if (EINA_UNLIKELY(exp)) \
- { \
- eina_error_set(EINA_ERROR_SAFETY_FAILED); \
- EINA_LOG_ERR("%s", "safety check failed: " # exp " is true"); \
- return val; \
- } \
- } \
- while (0)
+ do \
+ { \
+ if (EINA_UNLIKELY(exp)) \
+ { \
+ eina_error_set(EINA_ERROR_SAFETY_FAILED); \
+ EINA_LOG_ERR("%s", "safety check failed: " # exp " is true"); \
+ return val; \
+ } \
+ } \
+ while (0)
#define EINA_SAFETY_ON_TRUE_GOTO(exp, label) \
- do \
- { \
- if (EINA_UNLIKELY(exp)) \
- { \
- eina_error_set(EINA_ERROR_SAFETY_FAILED); \
- EINA_LOG_ERR("%s", "safety check failed: " # exp " is true"); \
- goto label; \
- } \
- } \
- while (0)
+ do \
+ { \
+ if (EINA_UNLIKELY(exp)) \
+ { \
+ eina_error_set(EINA_ERROR_SAFETY_FAILED); \
+ EINA_LOG_ERR("%s", "safety check failed: " # exp " is true"); \
+ goto label; \
+ } \
+ } \
+ while (0)
#define EINA_SAFETY_ON_FALSE_RETURN(exp) \
- do \
- { \
- if (EINA_UNLIKELY(!(exp))) \
- { \
- eina_error_set(EINA_ERROR_SAFETY_FAILED); \
- EINA_LOG_ERR("%s", "safety check failed: " # exp " is false"); \
- return; \
- } \
- } \
- while (0)
+ do \
+ { \
+ if (EINA_UNLIKELY(!(exp))) \
+ { \
+ eina_error_set(EINA_ERROR_SAFETY_FAILED); \
+ EINA_LOG_ERR("%s", "safety check failed: " # exp " is false"); \
+ return; \
+ } \
+ } \
+ while (0)
#define EINA_SAFETY_ON_FALSE_RETURN_VAL(exp, val) \
- do \
- { \
- if (EINA_UNLIKELY(!(exp))) \
- { \
- eina_error_set(EINA_ERROR_SAFETY_FAILED); \
- EINA_LOG_ERR("%s", "safety check failed: " # exp " is false"); \
- return val; \
- } \
- } \
- while (0)
+ do \
+ { \
+ if (EINA_UNLIKELY(!(exp))) \
+ { \
+ eina_error_set(EINA_ERROR_SAFETY_FAILED); \
+ EINA_LOG_ERR("%s", "safety check failed: " # exp " is false"); \
+ return val; \
+ } \
+ } \
+ while (0)
#define EINA_SAFETY_ON_FALSE_GOTO(exp, label) \
- do \
- { \
- if (EINA_UNLIKELY(!(exp))) \
- { \
- eina_error_set(EINA_ERROR_SAFETY_FAILED); \
- EINA_LOG_ERR("%s", "safety check failed: " # exp " is false"); \
- goto label; \
- } \
- } \
- while (0)
+ do \
+ { \
+ if (EINA_UNLIKELY(!(exp))) \
+ { \
+ eina_error_set(EINA_ERROR_SAFETY_FAILED); \
+ EINA_LOG_ERR("%s", "safety check failed: " # exp " is false"); \
+ goto label; \
+ } \
+ } \
+ while (0)
#ifdef EINA_ARG_NONNULL
/* make EINA_ARG_NONNULL void so GCC does not optimize safety checks */
#else /* no safety checks */
-#define EINA_SAFETY_ON_NULL_RETURN(exp) \
- do { (void)((exp) == NULL); } while (0)
+#define EINA_SAFETY_ON_NULL_RETURN(exp) \
+ do { (void)((exp) == NULL); } while (0)
-#define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val) \
- do { if (0 && (exp) == NULL) { (void)val; } } while (0)
+#define EINA_SAFETY_ON_NULL_RETURN_VAL(exp, val) \
+ do { if (0 && (exp) == NULL) { (void)val; } } while (0)
-#define EINA_SAFETY_ON_NULL_GOTO(exp, label) \
- do { if (0 && (exp) == NULL) { goto label; } } while (0)
+#define EINA_SAFETY_ON_NULL_GOTO(exp, label) \
+ do { if (0 && (exp) == NULL) { goto label; } } while (0)
-#define EINA_SAFETY_ON_TRUE_RETURN(exp) \
- do { (void)(exp); } while (0)
+#define EINA_SAFETY_ON_TRUE_RETURN(exp) \
+ do { (void)(exp); } while (0)
-#define EINA_SAFETY_ON_TRUE_RETURN_VAL(exp, val) \
- do { if (0 && (exp)) { (void)val; } } while (0)
+#define EINA_SAFETY_ON_TRUE_RETURN_VAL(exp, val) \
+ do { if (0 && (exp)) { (void)val; } } while (0)
-#define EINA_SAFETY_ON_TRUE_GOTO(exp, label) \
- do { if (0 && (exp)) { goto label; } } while (0)
+#define EINA_SAFETY_ON_TRUE_GOTO(exp, label) \
+ do { if (0 && (exp)) { goto label; } } while (0)
-#define EINA_SAFETY_ON_FALSE_RETURN(exp) \
- do { (void)(!(exp)); } while (0)
+#define EINA_SAFETY_ON_FALSE_RETURN(exp) \
+ do { (void)(!(exp)); } while (0)
-#define EINA_SAFETY_ON_FALSE_RETURN_VAL(exp, val) \
- do { if (0 && !(exp)) { (void)val; } } while (0)
+#define EINA_SAFETY_ON_FALSE_RETURN_VAL(exp, val) \
+ do { if (0 && !(exp)) { (void)val; } } while (0)
-#define EINA_SAFETY_ON_FALSE_GOTO(exp, label) \
- do { if (0 && !(exp)) { goto label; } } while (0)
+#define EINA_SAFETY_ON_FALSE_GOTO(exp, label) \
+ do { if (0 && !(exp)) { goto label; } } while (0)
#endif /* safety checks macros */
#endif /* EINA_SAFETY_CHECKS_H_ */
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)
* @brief Join two static strings and store the result in a static buffer.
*