| 36 | } |
| 37 | |
| 38 | void Iterator::RegisterCleanup(CleanupFunction func, void* arg1, void* arg2) { |
| 39 | assert(func != nullptr); |
| 40 | Cleanup* c; |
| 41 | if (cleanup_.function == nullptr) { |
| 42 | c = &cleanup_; |
| 43 | } else { |
| 44 | c = new Cleanup; |
| 45 | c->next = cleanup_.next; |
| 46 | cleanup_.next = c; |
| 47 | } |
| 48 | c->function = func; |
| 49 | c->arg1 = arg1; |
| 50 | c->arg2 = arg2; |
| 51 | } |
| 52 | |
| 53 | namespace { |
| 54 | class EmptyIterator : public Iterator { |