From fbc803b9839c19a65c6c46421147c29b46f446fb Mon Sep 17 00:00:00 2001 From: Maxim Solovyov Date: Fri, 15 Sep 2023 00:57:33 +0300 Subject: [PATCH] c2: address some clang-tidy issues, run clang-format --- src/c2.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/c2.c b/src/c2.c index 823d30ea..d82448aa 100644 --- a/src/c2.c +++ b/src/c2.c @@ -233,14 +233,16 @@ static inline long winprop_get_int(winprop_t prop, size_t index) { */ static inline int strcmp_wd(const char *needle, const char *src) { int ret = mstrncmp(needle, src); - if (ret) + if (ret) { return ret; + } char c = src[strlen(needle)]; - if (isalnum((unsigned char)c) || '_' == c) + if (isalnum((unsigned char)c) || '_' == c) { return 1; - else - return 0; + } + + return 0; } /** @@ -254,8 +256,9 @@ static inline attr_unused bool c2_ptr_isempty(const c2_ptr_t p) { * Reset a c2_ptr_t. */ static inline void c2_ptr_reset(c2_ptr_t *pp) { - if (pp) + if (pp) { memcpy(pp, &C2_PTR_NULL, sizeof(c2_ptr_t)); + } } /** @@ -988,7 +991,7 @@ static int c2_parse_legacy(const char *pattern, int offset, c2_ptr_t *presult) { // Determine the pattern target #define TGTFILL(pdefid) \ - (pleaf->predef = pdefid, pleaf->type = C2_PREDEFS[pdefid].type, \ + (pleaf->predef = (pdefid), pleaf->type = C2_PREDEFS[pdefid].type, \ pleaf->format = C2_PREDEFS[pdefid].format) switch (pattern[offset]) { case 'n': TGTFILL(C2_L_PNAME); break;