@@ -76,38 +76,38 @@ static void potential_deadlock_detected(const std::pair<void*, void*>& mismatch,
7676
7777 LogPrintf (" POTENTIAL DEADLOCK DETECTED\n " );
7878 LogPrintf (" Previous lock order was:\n " );
79- for (const PAIRTYPE ( void *, CLockLocation) & i : s2) {
80- if (i. first == mismatch.first ) {
79+ for (const auto & [lockPtr, lockLoc] : s2) {
80+ if (lockPtr == mismatch.first ) {
8181 LogPrintf (" (1)" );
82- if (!firstLocked && secondLocked && i. second .fTry )
82+ if (!firstLocked && secondLocked && lockLoc .fTry )
8383 onlyMaybeDeadlock = true ;
8484 firstLocked = true ;
8585 }
86- if (i. first == mismatch.second ) {
86+ if (lockPtr == mismatch.second ) {
8787 LogPrintf (" (2)" );
88- if (!secondLocked && firstLocked && i. second .fTry )
88+ if (!secondLocked && firstLocked && lockLoc .fTry )
8989 onlyMaybeDeadlock = true ;
9090 secondLocked = true ;
9191 }
92- LogPrintf (" %s\n " , i. second .ToString ());
92+ LogPrintf (" %s\n " , lockLoc .ToString ());
9393 }
9494 firstLocked = false ;
9595 secondLocked = false ;
9696 LogPrintf (" Current lock order is:\n " );
97- for (const PAIRTYPE ( void *, CLockLocation) & i : s1) {
98- if (i. first == mismatch.first ) {
97+ for (const auto & [lockPtr, lockLoc] : s1) {
98+ if (lockPtr == mismatch.first ) {
9999 LogPrintf (" (1)" );
100- if (!firstLocked && secondLocked && i. second .fTry )
100+ if (!firstLocked && secondLocked && lockLoc .fTry )
101101 onlyMaybeDeadlock = true ;
102102 firstLocked = true ;
103103 }
104- if (i. first == mismatch.second ) {
104+ if (lockPtr == mismatch.second ) {
105105 LogPrintf (" (2)" );
106- if (!secondLocked && firstLocked && i. second .fTry )
106+ if (!secondLocked && firstLocked && lockLoc .fTry )
107107 onlyMaybeDeadlock = true ;
108108 secondLocked = true ;
109109 }
110- LogPrintf (" %s\n " , i. second .ToString ());
110+ LogPrintf (" %s\n " , lockLoc .ToString ());
111111 }
112112 assert (onlyMaybeDeadlock);
113113}
@@ -122,16 +122,16 @@ static void push_lock(void* c, const CLockLocation& locklocation, bool fTry)
122122 (*lockstack).push_back (std::make_pair (c, locklocation));
123123
124124 if (!fTry ) {
125- for (const PAIRTYPE ( void *, CLockLocation) & i : (*lockstack)) {
126- if (i. first == c)
125+ for (const auto & [lockPtr, lockLoc] : (*lockstack)) {
126+ if (lockPtr == c)
127127 break ;
128128
129- std::pair<void *, void *> p1 = std::make_pair (i. first , c);
129+ std::pair<void *, void *> p1 = std::make_pair (lockPtr , c);
130130 if (lockorders.count (p1))
131131 continue ;
132132 lockorders[p1] = (*lockstack);
133133
134- std::pair<void *, void *> p2 = std::make_pair (c, i. first );
134+ std::pair<void *, void *> p2 = std::make_pair (c, lockPtr );
135135 if (lockorders.count (p2))
136136 potential_deadlock_detected (p1, lockorders[p2], lockorders[p1]);
137137 }
@@ -159,15 +159,15 @@ void LeaveCritical()
159159std::string LocksHeld ()
160160{
161161 std::string result;
162- for (const PAIRTYPE ( void *, CLockLocation) & i : *lockstack)
163- result += i. second .ToString () + std::string (" \n " );
162+ for (const auto & [lockPtr, lockLoc] : *lockstack)
163+ result += lockLoc .ToString () + std::string (" \n " );
164164 return result;
165165}
166166
167167void AssertLockHeldInternal (const char * pszName, const char * pszFile, int nLine, void * cs)
168168{
169- for (const PAIRTYPE ( void *, CLockLocation) & i : *lockstack)
170- if (i. first == cs)
169+ for (const auto & [lockPtr, lockLoc] : *lockstack)
170+ if (lockPtr == cs)
171171 return ;
172172 fprintf (stderr, " Assertion failed: lock %s not held in %s:%i; locks held:\n %s" , pszName, pszFile, nLine, LocksHeld ().c_str ());
173173 abort ();
0 commit comments