Module Name: src Committed By: mrg Date: Thu Aug 8 04:32:43 UTC 2013Modified Files: src/common/lib/libutil: snprintb.c Log Message: apply some do { ... } while (0) so that macros aren't broken, completing the previous change.
Now that the macros themselves are updated, is there any reason not to remove extraneous { ... } around their invocations?
Diffs are attached... ------------------------------------------------------------------------- | Paul Goyette | PGP Key fingerprint: | E-mail addresses: | | Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com | | Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net | | Kernel Developer | | pgoyette at netbsd.org | -------------------------------------------------------------------------
--- snprintb.c 2013-08-07 21:58:22.000000000 -0700 +++ /home/paul/snprintb.c 2013-08-08 08:44:38.000000000 -0700 @@ -151,9 +151,9 @@ #define PUTCHR(c) do { \ if (l_max > 0 && (size_t)l_len >= (l_max - 1)) {\ BACKUP; \ - if (restart == 0) { \ + if (restart == 0) \ STORE(c); \ - } else \ + else \ sep = '<'; \ } else { \ STORE(c); \ @@ -217,12 +217,10 @@ sep = ','; if (ch == 'F') /* just extract */ break; - if (restart == 0) { + if (restart == 0) PUTS(bitfmt); - } - if (restart == 0) { + if (restart == 0) PUTCHR('='); - } if (restart == 0) { f_len = snprintf(bp, buflen - t_len, sbase, field); @@ -232,10 +230,8 @@ l_len += f_len; if ((size_t)t_len < buflen) bp += f_len; - if (l_max > 0 && - (size_t)l_len > l_max) { + if (l_max > 0 && (size_t)l_len > l_max) PUTCHR('#'); - } } break; case '=': @@ -248,9 +244,8 @@ */ if ((int)field != bit) goto skip; - if (ch == '=') { + if (ch == '=') PUTCHR('='); - } PUTS(bitfmt); break; default: