Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Protect multi statement macro with do {} while (0)....



details:   https://anonhg.NetBSD.org/src/rev/9c1be9051b98
branches:  trunk
changeset: 517886:9c1be9051b98
user:      enami <enami%NetBSD.org@localhost>
date:      Wed Nov 21 00:55:39 2001 +0000

description:
Protect multi statement macro with do {} while (0).  This is not cosmetic.

diffstat:

 sys/kern/subr_prf.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 46f34cc2185d -r 9c1be9051b98 sys/kern/subr_prf.c
--- a/sys/kern/subr_prf.c       Wed Nov 21 00:48:28 2001 +0000
+++ b/sys/kern/subr_prf.c       Wed Nov 21 00:55:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_prf.c,v 1.82 2001/11/12 15:25:21 lukem Exp $      */
+/*     $NetBSD: subr_prf.c,v 1.83 2001/11/21 00:55:39 enami Exp $      */
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.82 2001/11/12 15:25:21 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.83 2001/11/21 00:55:39 enami Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ipkdb.h"
@@ -793,10 +793,11 @@
        if (((val == 0) && (ch != '\177')) || left < 3)
                return (buf);
 
-#define PUTBYTE(b, c, l)       \
+#define PUTBYTE(b, c, l) do {  \
        *(b)++ = (c);           \
        if (--(l) == 0)         \
-               goto out;
+               goto out;       \
+} while (0)
 #define PUTSTR(b, p, l) do {           \
        int c;                          \
        while ((c = *(p)++) != 0) {     \



Home | Main Index | Thread Index | Old Index