source: webkit/trunk/JavaScriptCore/kjs/LabelStack.h@ 35900

Last change on this file since 35900 was 35027, checked in by [email protected], 17 years ago

JavaScriptCore:

2008-07-06 Sam Weinig <[email protected]>

Reviewed by Cameron Zwarich.

Second step in broad cleanup effort.

[ File list elided ]

WebCore:

2008-07-06 Sam Weinig <[email protected]>

Reviewed by Cameron Zwarich.

Add #include for kjs/protect.h.

  • xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::loadRequestAsynchronously):
  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1/*
2 * Copyright (C) 1999-2001 Harri Porten ([email protected])
3 * Copyright (C) 2001 Peter Kelly ([email protected])
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef LabelStack_h
24#define LabelStack_h
25
26#include "identifier.h"
27#include <wtf/Noncopyable.h>
28
29namespace KJS {
30
31 class LabelStack : Noncopyable {
32 public:
33 LabelStack()
34 : m_topOfStack(0)
35 {
36 }
37 ~LabelStack();
38
39 bool push(const Identifier &id);
40 bool contains(const Identifier &id) const;
41 void pop();
42
43 private:
44 struct StackElem {
45 Identifier id;
46 StackElem* prev;
47 };
48
49 StackElem* m_topOfStack;
50 };
51
52 inline LabelStack::~LabelStack()
53 {
54 StackElem* prev;
55 for (StackElem* e = m_topOfStack; e; e = prev) {
56 prev = e->prev;
57 delete e;
58 }
59 }
60
61 inline void LabelStack::pop()
62 {
63 if (StackElem* e = m_topOfStack) {
64 m_topOfStack = e->prev;
65 delete e;
66 }
67 }
68
69} // namespace KJS
70
71#endif // LabelStack_h
Note: See TracBrowser for help on using the repository browser.