From f165655bb41ebd3a5d96d6f407ece32d0809f272 Mon Sep 17 00:00:00 2001 From: "finnur@chromium.org" Date: Tue, 24 Sep 2013 12:47:54 +0000 Subject: [PATCH] Fix possible naming conflict in macro. The ObserverList macro (FOR_EACH_OBSERVER) uses an iterator named |it|, which can in some cases conflict with locally defined variables. Make the iterator variable name slightly more unique BUG=None R=jar@chromium.org Review URL: https://codereview.chromium.org/23672052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@224985 0039d316-1c4b-4281-b951-d872f2087c98 --- base/observer_list.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/base/observer_list.h b/base/observer_list.h index b44e33f56c73..bd1dc64055b4 100644 --- a/base/observer_list.h +++ b/base/observer_list.h @@ -203,14 +203,15 @@ class ObserverList : public ObserverListBase { } }; -#define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \ - do { \ - if ((observer_list).might_have_observers()) { \ - ObserverListBase::Iterator it(observer_list); \ - ObserverType* obs; \ - while ((obs = it.GetNext()) != NULL) \ - obs->func; \ - } \ +#define FOR_EACH_OBSERVER(ObserverType, observer_list, func) \ + do { \ + if ((observer_list).might_have_observers()) { \ + ObserverListBase::Iterator \ + it_inside_observer_macro(observer_list); \ + ObserverType* obs; \ + while ((obs = it_inside_observer_macro.GetNext()) != NULL) \ + obs->func; \ + } \ } while (0) #endif // BASE_OBSERVER_LIST_H__ -- 2.11.4.GIT