summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-02 22:50:31 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-02 22:50:31 +0000
commitfd61a78303ae67772abec331647a90d0c419f32b (patch)
tree633fabe18168c32ab50ef6efb3581b117cabc000 /ext
parent60bfa43238c8c2ea9397ca26f88fcf2cd4216f2f (diff)
use do/while(0) around GetDBM macros
* README.EXT: wrap GetDBM with do/while(0) * README.EXT.ja: ditto * ext/dbm/dbm.c: ditto, likewise for GetDBM2 * ext/gdbm/gdbm.c: ditto * ext/sdbm/init.c: ditto [ruby-core:61217] ref: http://c-faq.com/cpp/multistmt.html git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/dbm/dbm.c8
-rw-r--r--ext/gdbm/gdbm.c4
-rw-r--r--ext/sdbm/init.c8
3 files changed, 10 insertions, 10 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 03616fd..ae31232 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -45,16 +45,16 @@ closed_dbm(void)
rb_raise(rb_eDBMError, "closed DBM file");
}
-#define GetDBM(obj, dbmp) {\
+#define GetDBM(obj, dbmp) do {\
Data_Get_Struct((obj), struct dbmdata, (dbmp));\
if ((dbmp) == 0) closed_dbm();\
if ((dbmp)->di_dbm == 0) closed_dbm();\
-}
+} while (0)
-#define GetDBM2(obj, data, dbm) {\
+#define GetDBM2(obj, data, dbm) do {\
GetDBM((obj), (data));\
(dbm) = dbmp->di_dbm;\
-}
+} while (0)
static void
free_dbm(struct dbmdata *dbmp)
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index e048415..ff2638e 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -106,10 +106,10 @@ closed_dbm(void)
if ((dbmp)->di_dbm == 0) closed_dbm();\
} while (0)
-#define GetDBM2(obj, data, dbm) {\
+#define GetDBM2(obj, data, dbm) do {\
GetDBM((obj), (data));\
(dbm) = dbmp->di_dbm;\
-}
+} while (0)
static void
free_dbm(struct dbmdata *dbmp)
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c
index 0f26bb8..596d954 100644
--- a/ext/sdbm/init.c
+++ b/ext/sdbm/init.c
@@ -77,16 +77,16 @@ closed_sdbm()
rb_raise(rb_eDBMError, "closed SDBM file");
}
-#define GetDBM(obj, dbmp) {\
+#define GetDBM(obj, dbmp) do {\
Data_Get_Struct((obj), struct dbmdata, (dbmp));\
if ((dbmp) == 0) closed_sdbm();\
if ((dbmp)->di_dbm == 0) closed_sdbm();\
-}
+} while (0)
-#define GetDBM2(obj, data, dbm) {\
+#define GetDBM2(obj, data, dbm) do {\
GetDBM((obj), (data));\
(dbm) = dbmp->di_dbm;\
-}
+} while (0)
static void
free_sdbm(struct dbmdata *dbmp)