diff --git a/legacy/eina/src/include/eina_accessor.h b/legacy/eina/src/include/eina_accessor.h index 3e715dbcbd..ae8197869c 100644 --- a/legacy/eina/src/include/eina_accessor.h +++ b/legacy/eina/src/include/eina_accessor.h @@ -68,14 +68,14 @@ struct _Eina_Accessor #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); @@ -129,10 +129,10 @@ 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)++) /** * @} diff --git a/legacy/eina/src/include/eina_array.h b/legacy/eina/src/include/eina_array.h index a5e071ef5c..bec7ac52f2 100644 --- a/legacy/eina/src/include/eina_array.h +++ b/legacy/eina/src/include/eina_array.h @@ -83,16 +83,16 @@ EAPI void eina_array_step_set(Eina_Array *array, 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; @@ -135,10 +135,10 @@ static inline Eina_Bool eina_array_foreach(Eina_Array *array, * 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" diff --git a/legacy/eina/src/include/eina_convert.h b/legacy/eina/src/include/eina_convert.h index d185ae1a3c..8cd64334f5 100644 --- a/legacy/eina/src/include/eina_convert.h +++ b/legacy/eina/src/include/eina_convert.h @@ -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 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, diff --git a/legacy/eina/src/include/eina_inline_str.x b/legacy/eina/src/include/eina_inline_str.x index 27b3540ce6..2daeb8524c 100644 --- a/legacy/eina/src/include/eina_inline_str.x +++ b/legacy/eina/src/include/eina_inline_str.x @@ -47,6 +47,28 @@ eina_strlen_bounded(const char *str, size_t maxlen) 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)); +} + /** * @} */ diff --git a/legacy/eina/src/include/eina_list.h b/legacy/eina/src/include/eina_list.h index 359e0110ba..a549076851 100644 --- a/legacy/eina/src/include/eina_list.h +++ b/legacy/eina/src/include/eina_list.h @@ -156,11 +156,12 @@ EAPI Eina_Accessor * eina_list_accessor_new(const Eina_List *list) * 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 @@ -203,13 +204,12 @@ EAPI Eina_Accessor * eina_list_accessor_new(const Eina_List *list) * 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 @@ -246,16 +246,14 @@ EAPI Eina_Accessor * eina_list_accessor_new(const Eina_List *list) * } * @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 @@ -294,18 +292,14 @@ EAPI Eina_Accessor * eina_list_accessor_new(const Eina_List *list) * } * @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 @@ -332,11 +326,11 @@ EAPI Eina_Accessor * eina_list_accessor_new(const Eina_List *list) * * @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" diff --git a/legacy/eina/src/include/eina_log.h b/legacy/eina/src/include/eina_log.h index fd1948e9e9..76b7864281 100644 --- a/legacy/eina/src/include/eina_log.h +++ b/legacy/eina/src/include/eina_log.h @@ -123,20 +123,20 @@ EAPI extern int EINA_LOG_DOMAIN_GLOBAL; */ #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 /** @@ -179,10 +179,10 @@ EAPI extern int EINA_LOG_DOMAIN_GLOBAL; * 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__) /** diff --git a/legacy/eina/src/include/eina_magic.h b/legacy/eina/src/include/eina_magic.h index 866d2ff34a..dd1a9f3a56 100644 --- a/legacy/eina/src/include/eina_magic.h +++ b/legacy/eina/src/include/eina_magic.h @@ -111,12 +111,13 @@ EAPI Eina_Bool eina_magic_string_static_set(Eina_Magic magic, * 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, diff --git a/legacy/eina/src/include/eina_private.h b/legacy/eina/src/include/eina_private.h index 7e8074bc14..2f8ff8117d 100644 --- a/legacy/eina/src/include/eina_private.h +++ b/legacy/eina/src/include/eina_private.h @@ -92,37 +92,37 @@ /* 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 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 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); diff --git a/legacy/eina/src/include/eina_rectangle.h b/legacy/eina/src/include/eina_rectangle.h index 2d31fbb822..4ce3955d53 100644 --- a/legacy/eina/src/include/eina_rectangle.h +++ b/legacy/eina/src/include/eina_rectangle.h @@ -83,9 +83,9 @@ EAPI void eina_rectangle_pool_release(Eina_Rectangle *rect) EINA_ARG_NONNULL(1); * 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; diff --git a/legacy/eina/src/include/eina_safety_checks.h b/legacy/eina/src/include/eina_safety_checks.h index b668d0e9b9..79ebc54fd3 100644 --- a/legacy/eina/src/include/eina_safety_checks.h +++ b/legacy/eina/src/include/eina_safety_checks.h @@ -79,112 +79,112 @@ EAPI extern Eina_Error EINA_ERROR_SAFETY_FAILED; #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 */ @@ -195,32 +195,32 @@ EAPI extern Eina_Error EINA_ERROR_SAFETY_FAILED; #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_ */ diff --git a/legacy/eina/src/include/eina_str.h b/legacy/eina/src/include/eina_str.h index 2d36c98295..1d12615e5a 100644 --- a/legacy/eina/src/include/eina_str.h +++ b/legacy/eina/src/include/eina_str.h @@ -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); -/** - * @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.