From 7faf115dfffaf12cdae98eac71fc6811059c6657 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 17 Jul 2012 09:33:38 -0400 Subject: Change all SMARTLIST_FOREACH loops of >=10 lines to use BEGIN/END The SMARTLIST_FOREACH macro is more convenient than BEGIN/END when you have a nice short loop body, but using it for long bodies makes your preprocessor tell the compiler that all the code is on the same line. That causes grief, since compiler warnings and debugger lines will all refer to that one line. So, here's a new style rule: SMARTLIST_FOREACH blocks need to be short. --- src/test/test.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/test/test.c') diff --git a/src/test/test.c b/src/test/test.c index 454fc54d5..6bf2d28d9 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -131,8 +131,7 @@ rm_rf(const char *dir) elements = tor_listdir(dir); if (elements) { - SMARTLIST_FOREACH(elements, const char *, cp, - { + SMARTLIST_FOREACH_BEGIN(elements, const char *, cp) { char *tmp = NULL; tor_asprintf(&tmp, "%s"PATH_SEPARATOR"%s", dir, cp); if (0 == stat(tmp,&st) && (st.st_mode & S_IFDIR)) { @@ -143,7 +142,7 @@ rm_rf(const char *dir) } } tor_free(tmp); - }); + } SMARTLIST_FOREACH_END(cp); SMARTLIST_FOREACH(elements, char *, cp, tor_free(cp)); smartlist_free(elements); } -- cgit v1.2.3