Fix M*LIB usage:

* Fix oplist definition of SubGhzFrequencyAnalyzerLogItem

* Fix oplist definition of M_CSTR_DUP_OPLIST

* Remove dependency of furi_string_utf8_decode
to the internal definition of string_unicode_t

* Replace obsolete macro M_IF_DEFAULT1 to M_DEFAULT_ARGS
This commit is contained in:
Patrick Pelissier
2023-06-06 22:34:06 +02:00
parent 4900e8b7a2
commit f466409985
4 changed files with 22 additions and 22 deletions
+15 -18
View File
@@ -633,20 +633,18 @@ void furi_string_utf8_decode(char c, FuriStringUTF8State* state, FuriStringUnico
* @brief Search for a string (or C string) in a string
* (string, [c]string[, start=0])
*/
#define furi_string_search(v, ...) \
#define furi_string_search(...) \
M_APPLY( \
FURI_STRING_SELECT3, \
furi_string_search, \
furi_string_search_str, \
v, \
M_IF_DEFAULT1(0, __VA_ARGS__))
M_DEFAULT_ARGS(3, (0), __VA_ARGS__))
/**
* @brief Search for a C string in a string
* (string, cstring[, start=0])
*/
#define furi_string_search_str(v, ...) \
M_APPLY(furi_string_search_str, v, M_IF_DEFAULT1(0, __VA_ARGS__))
#define furi_string_search_str( ...) \
furi_string_search_str( M_DEFAULT_ARGS(3, (0), __VA_ARGS__) )
/**
* @brief Test if the string starts with the given string (or C string).
@@ -672,41 +670,40 @@ void furi_string_utf8_decode(char c, FuriStringUTF8State* state, FuriStringUnico
* @brief Trim a string from the given set of characters (default is " \n\r\t").
* (string[, set=" \n\r\t"])
*/
#define furi_string_trim(...) M_APPLY(furi_string_trim, M_IF_DEFAULT1(" \n\r\t", __VA_ARGS__))
#define furi_string_trim(...) \
furi_string_trim( M_DEFAULT_ARGS(2, (" \n\r\t"), __VA_ARGS__) )
/**
* @brief Search for a character in a string.
* (string, character[, start=0])
*/
#define furi_string_search_char(v, ...) \
M_APPLY(furi_string_search_char, v, M_IF_DEFAULT1(0, __VA_ARGS__))
#define furi_string_search_char(...) \
furi_string_search_char( M_DEFAULT_ARGS(3, (0), __VA_ARGS__) )
/**
* @brief Reverse Search for a character in a string.
* (string, character[, start=0])
*/
#define furi_string_search_rchar(v, ...) \
M_APPLY(furi_string_search_rchar, v, M_IF_DEFAULT1(0, __VA_ARGS__))
#define furi_string_search_rchar( ...) \
furi_string_search_rchar( M_DEFAULT_ARGS(3, (0), __VA_ARGS__) )
/**
* @brief Replace a string to another string (or C string to another C string) in a string.
* (string, [c]string, [c]string[, start=0])
*/
#define furi_string_replace(a, b, ...) \
#define furi_string_replace(...) \
M_APPLY( \
FURI_STRING_SELECT4, \
furi_string_replace, \
furi_string_replace_str, \
a, \
b, \
M_IF_DEFAULT1(0, __VA_ARGS__))
M_DEFAULT_ARGS(4, (0), __VA_ARGS__))
/**
* @brief Replace a C string to another C string in a string.
* (string, cstring, cstring[, start=0])
*/
#define furi_string_replace_str(a, b, ...) \
M_APPLY(furi_string_replace_str, a, b, M_IF_DEFAULT1(0, __VA_ARGS__))
#define furi_string_replace_str(...) \
furi_string_replace_str( M_DEFAULT_ARGS(4, (0), __VA_ARGS__) )
/**
* @brief INIT OPLIST for FuriString.
@@ -743,4 +740,4 @@ void furi_string_utf8_decode(char c, FuriStringUTF8State* state, FuriStringUnico
#ifdef __cplusplus
}
#endif
#endif