Skip to content

Commit bb5ca2b

Browse files
committed
Replace an unnecessary comma operator in addrtostr6()
Use of comma as statement separator is discouraged and reported as warning by clang with -Wcomma. the use of ';' to separate to assignments is more appropriate than ','. The warning was: addrtostr.c:131:24: warning: possible misuse of comma operator here [-Wcomma] cur.base = i, cur.len = 1; ^
1 parent c109aa2 commit bb5ca2b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

addrtostr.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ addrtostr6 (const void *src, char *dst, size_t size)
127127
cur.base = -1;
128128
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) {
129129
if (words[i] == 0) {
130-
if (cur.base == -1)
131-
cur.base = i, cur.len = 1;
132-
else cur.len++;
130+
if (cur.base == -1) {
131+
cur.base = i;
132+
cur.len = 1;
133+
} else
134+
cur.len++;
133135
} else if (cur.base != -1) {
134136
if (best.base == -1 || cur.len > best.len)
135137
best = cur;

0 commit comments

Comments
 (0)