From 7f339ecbd3d80cad057da964ed9b85430c38cffe Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 23 Nov 2017 15:03:29 +0000 Subject: [PATCH] [libobjc] Wrap CLASS_TABLE_HASH in do {} while (0) 2017-11-23 Tom de Vries * class.c (CLASS_TABLE_HASH): Wrap in "do {} while (0)". From-SVN: r255099 --- libobjc/ChangeLog | 4 ++++ libobjc/class.c | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 2f9361ffe45..e1d32b6171a 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,7 @@ +2017-11-23 Tom de Vries + + * class.c (CLASS_TABLE_HASH): Wrap in "do {} while (0)". + 2017-11-17 Igor Tsimbalist * Makefile.in: Regenerate. diff --git a/libobjc/class.c b/libobjc/class.c index 53fb5fe8efb..7a8f832e89b 100644 --- a/libobjc/class.c +++ b/libobjc/class.c @@ -153,14 +153,16 @@ static objc_mutex_t __class_table_lock = NULL; string, and HASH the computed hash of the string; CLASS_NAME is untouched. */ -#define CLASS_TABLE_HASH(INDEX, HASH, CLASS_NAME) \ - HASH = 0; \ - for (INDEX = 0; CLASS_NAME[INDEX] != '\0'; INDEX++) \ - { \ - HASH = (HASH << 4) ^ (HASH >> 28) ^ CLASS_NAME[INDEX]; \ - } \ - \ - HASH = (HASH ^ (HASH >> 10) ^ (HASH >> 20)) & CLASS_TABLE_MASK; +#define CLASS_TABLE_HASH(INDEX, HASH, CLASS_NAME) \ + do { \ + HASH = 0; \ + for (INDEX = 0; CLASS_NAME[INDEX] != '\0'; INDEX++) \ + { \ + HASH = (HASH << 4) ^ (HASH >> 28) ^ CLASS_NAME[INDEX]; \ + } \ + \ + HASH = (HASH ^ (HASH >> 10) ^ (HASH >> 20)) & CLASS_TABLE_MASK; \ + } while (0) /* Setup the table. */ static void -- 2.30.2