diff options
author | Thomas Haller <thaller@redhat.com> | 2019-04-02 12:35:03 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-04-04 21:01:15 +0200 |
commit | 08c327f8a60e884752092a27195c3f2725a95790 (patch) | |
tree | 34f8aea8c2556a40c40f2886dd7c43c0a8d5f0ea /shared/nm-utils | |
parent | 9c049b3a0064f6054a816ad1de94a13f33a1db7f (diff) | |
download | NetworkManager-08c327f8a60e884752092a27195c3f2725a95790.tar.gz |
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").
Diffstat (limited to 'shared/nm-utils')
-rw-r--r-- | shared/nm-utils/nm-macros-internal.h | 12 | ||||
-rw-r--r-- | shared/nm-utils/nm-shared-utils.h | 24 |
2 files changed, 18 insertions, 18 deletions
diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h index 245bb1d8af..33ed5980d4 100644 --- a/shared/nm-utils/nm-macros-internal.h +++ b/shared/nm-utils/nm-macros-internal.h @@ -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 * diff --git a/shared/nm-utils/nm-shared-utils.h b/shared/nm-utils/nm-shared-utils.h index af9e1cf6e9..3132d155b1 100644 --- a/shared/nm-utils/nm-shared-utils.h +++ b/shared/nm-utils/nm-shared-utils.h @@ -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); \ }) /*****************************************************************************/ |