1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +03:00

libdm: enclose dm_stats_walk_do/while() body in do..while

The call to dm_stats_walk_start() before the do statement makes
dm_stats_walk_do() behave inconsistently depending on context;
wrap them in an additional do { } while (0) so that the macro
always expands to a valid statement.
This commit is contained in:
Bryn M. Reeves 2016-07-07 21:28:35 +01:00
parent 6233bcf52d
commit 5e06b33c51

View File

@ -1146,15 +1146,17 @@ for (dm_stats_walk_init((dms), DM_STATS_WALK_GROUP), \
* empty. * empty.
*/ */
#define dm_stats_walk_do(dms) \ #define dm_stats_walk_do(dms) \
dm_stats_walk_start((dms)); \ do { \
do dm_stats_walk_start((dms)); \
do
/* /*
* Start a 'while' style loop or end a 'do..while' loop iterating over the * Start a 'while' style loop or end a 'do..while' loop iterating over the
* regions contained in dm_stats handle 'dms'. * regions contained in dm_stats handle 'dms'.
*/ */
#define dm_stats_walk_while(dms) \ #define dm_stats_walk_while(dms) \
while(!dm_stats_walk_end((dms))) while(!dm_stats_walk_end((dms))); \
} while (0)
/* /*
* Cursor relative property methods * Cursor relative property methods