From fd61a78303ae67772abec331647a90d0c419f32b Mon Sep 17 00:00:00 2001 From: normal Date: Sun, 2 Mar 2014 22:50:31 +0000 Subject: 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 --- README.EXT | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'README.EXT') diff --git a/README.EXT b/README.EXT index b1a816c271..ecc96933a3 100644 --- a/README.EXT +++ b/README.EXT @@ -683,10 +683,10 @@ wrapping DBM* directly, because we want to cache size information. To retrieve the dbmdata structure from a Ruby object, we define the following macro: - #define GetDBM(obj, dbmp) {\ + #define GetDBM(obj, dbmp) do {\ Data_Get_Struct(obj, struct dbmdata, dbmp);\ if (dbmp->di_dbm == 0) closed_dbm();\ - } + } while (0) This sort of complicated macro does the retrieving and close checking for the DBM. -- cgit v1.2.1