Ignore:
Timestamp:
Jul 6, 2008, 7:49:29 PM (17 years ago)
Author:
[email protected]
Message:

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):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/LabelStack.h

    r29663 r35027  
    1 // -*- mode: c++; c-basic-offset: 4 -*-
    21/*
    32 *  Copyright (C) 1999-2001 Harri Porten ([email protected])
    43 *  Copyright (C) 2001 Peter Kelly ([email protected])
    5  *  Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
    65 *
    76 *  This library is free software; you can redistribute it and/or
     
    2221 */
    2322
    24 #ifndef KJS_LABEL_STACK_H
    25 #define KJS_LABEL_STACK_H
     23#ifndef LabelStack_h
     24#define LabelStack_h
    2625
    2726#include "identifier.h"
     
    2928
    3029namespace KJS {
    31   /**
    32    * @short The "label set" in Ecma-262 spec
    33    */
    34   class LabelStack : Noncopyable {
    35   public:
    36     LabelStack()
    37       : tos(0)
    38     {
    39     }
    40     ~LabelStack();
    4130
    42     /**
    43      * If id is not empty and is not in the stack already, puts it on top of
    44      * the stack and returns true, otherwise returns false
    45      */
    46     bool push(const Identifier &id);
    47     /**
    48      * Is the id in the stack?
    49      */
    50     bool contains(const Identifier &id) const;
    51     /**
    52      * Removes from the stack the last pushed id (what else?)
    53      */
    54     void pop();
     31    class LabelStack : Noncopyable {
     32    public:
     33        LabelStack()
     34            : m_topOfStack(0)
     35        {
     36        }
     37        ~LabelStack();
    5538
    56   private:
    57     struct StackElem {
    58       Identifier id;
    59       StackElem *prev;
     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;
    6050    };
    6151
    62     StackElem *tos;
    63   };
     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    }
    6460
    65 inline LabelStack::~LabelStack()
    66 {
    67     StackElem *prev;
    68     for (StackElem *e = tos; e; e = prev) {
    69         prev = e->prev;
    70         delete e;
     61    inline void LabelStack::pop()
     62    {
     63        if (StackElem* e = m_topOfStack) {
     64            m_topOfStack = e->prev;
     65            delete e;
     66        }
    7167    }
    72 }
    7368
    74 inline void LabelStack::pop()
    75 {
    76     if (StackElem *e = tos) {
    77         tos = e->prev;
    78         delete e;
    79     }
    80 }
     69} // namespace KJS
    8170
    82 }
    83 
    84 #endif // KJS_LABEL_STACK_H
     71#endif // LabelStack_h
Note: See TracChangeset for help on using the changeset viewer.