mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 09:58:07 +02:00
shared/trivial: rename variables in nm_strndup_a() and nm_str_skip_leading_spaces() macros
"_str" is a very tempting name for a temporary variable. Rename the variable in nm_strndup_a() macro, so that other macros can call these (more general) macros (and still use the name "_str").
This commit is contained in:
parent
9c049b3a00
commit
08c327f8a6
2 changed files with 18 additions and 18 deletions
|
|
@ -1342,14 +1342,14 @@ _NM_BACKPORT_SYMBOL_IMPL(version, return_type, func, _##func##_##version, args_t
|
|||
|
||||
#define nm_str_skip_leading_spaces(str) \
|
||||
({ \
|
||||
typeof (*(str)) *_str = (str); \
|
||||
_nm_unused const char *_str_type_check = _str; \
|
||||
typeof (*(str)) *_str_sls = (str); \
|
||||
_nm_unused const char *const _str_type_check = _str_sls; \
|
||||
\
|
||||
if (_str) { \
|
||||
while (g_ascii_isspace (_str[0])) \
|
||||
_str++; \
|
||||
if (_str_sls) { \
|
||||
while (g_ascii_isspace (_str_sls[0])) \
|
||||
_str_sls++; \
|
||||
} \
|
||||
_str; \
|
||||
_str_sls; \
|
||||
})
|
||||
|
||||
static inline char *
|
||||
|
|
|
|||
|
|
@ -314,23 +314,23 @@ _nm_strndup_a_step (char *s, const char *str, gsize len)
|
|||
* NUL character and then filled with NUL characters. */
|
||||
#define nm_strndup_a(alloca_maxlen, str, len, out_str_free) \
|
||||
({ \
|
||||
const gsize _alloca_maxlen = (alloca_maxlen); \
|
||||
const char *const _str = (str); \
|
||||
const gsize _len = (len); \
|
||||
char **const _out_str_free = (out_str_free); \
|
||||
char *_s; \
|
||||
const gsize _alloca_maxlen_snd = (alloca_maxlen); \
|
||||
const char *const _str_snd = (str); \
|
||||
const gsize _len_snd = (len); \
|
||||
char **const _out_str_free_snd = (out_str_free); \
|
||||
char *_s_snd; \
|
||||
\
|
||||
G_STATIC_ASSERT_EXPR ((alloca_maxlen) <= 300); \
|
||||
\
|
||||
if ( _out_str_free \
|
||||
&& _len >= _alloca_maxlen) { \
|
||||
_s = g_malloc (_len + 1); \
|
||||
*_out_str_free = _s; \
|
||||
if ( _out_str_free_snd \
|
||||
&& _len_snd >= _alloca_maxlen_snd) { \
|
||||
_s_snd = g_malloc (_len_snd + 1); \
|
||||
*_out_str_free_snd = _s_snd; \
|
||||
} else { \
|
||||
g_assert (_len < _alloca_maxlen); \
|
||||
_s = g_alloca (_len + 1); \
|
||||
g_assert (_len_snd < _alloca_maxlen_snd); \
|
||||
_s_snd = g_alloca (_len_snd + 1); \
|
||||
} \
|
||||
_nm_strndup_a_step (_s, _str, _len); \
|
||||
_nm_strndup_a_step (_s_snd, _str_snd, _len_snd); \
|
||||
})
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue