Ignore:
Timestamp:
Feb 2, 2006, 12:22:43 AM (19 years ago)
Author:
darin
Message:

Reviewed by Maciej.

  • kxmlcore/Noncopyable.h: Added.
  • kxmlcore/OwnArrayPtr.h: Added.
  • kxmlcore/OwnPtr.h: Added.
  • kjs/function.h:
  • kjs/function.cpp: Use OwnPtr for Parameter pointers.
  • kjs/internal.h: Use Noncopyable for LabelStack.
  • kjs/list.cpp: Use OwnArrayPtr for overflow.
  • kjs/property_map.h:
  • kjs/property_map.cpp: Use OwnArrayPtr for SavedProperties. Use Vector for some stack buffers.
  • kjs/regexp_object.h:
  • kjs/regexp_object.cpp: Use OwnArrayPtr for lastOvector.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/function.cpp

    r12317 r12523  
    5151  class Parameter {
    5252  public:
    53     Parameter(const Identifier &n) : name(n), next(0L) { }
    54     ~Parameter() { delete next; }
     53    Parameter(const Identifier &n) : name(n) { }
    5554    Identifier name;
    56     Parameter *next;
     55    OwnPtr<Parameter> next;
    5756  };
    5857
     
    6665FunctionImp::~FunctionImp()
    6766{
    68   delete param;
    6967}
    7068
     
    146144void FunctionImp::addParameter(const Identifier &n)
    147145{
    148   Parameter **p = &param;
     146  OwnPtr<Parameter> *p = &param;
    149147  while (*p)
    150148    p = &(*p)->next;
    151149
    152   *p = new Parameter(n);
     150  p->set(new Parameter(n));
    153151}
    154152
     
    156154{
    157155  UString s;
    158   const Parameter *p = param;
     156  const Parameter *p = param.get();
    159157  while (p) {
    160158    if (!s.isEmpty())
    161159        s += ", ";
    162160    s += p->name.ustring();
    163     p = p->next;
     161    p = p->next.get();
    164162  }
    165163
     
    181179  if (param) {
    182180    ListIterator it = args.begin();
    183     Parameter *p = param;
     181    Parameter *p = param.get();
    184182    JSValue  *v = *it;
    185183    while (p) {
     
    193191      } else
    194192        variable->put(exec, p->name, jsUndefined());
    195       p = p->next;
     193      p = p->next.get();
    196194    }
    197195  }
     
    224222{
    225223  FunctionImp *thisObj = static_cast<FunctionImp *>(slot.slotBase());
    226   const Parameter *p = thisObj->param;
     224  const Parameter *p = thisObj->param.get();
    227225  int count = 0;
    228226  while (p) {
    229227    ++count;
    230     p = p->next;
     228    p = p->next.get();
    231229  }
    232230  return jsNumber(count);
     
    274272{
    275273  int i = 0;
    276   Parameter *p = param;
     274  Parameter *p = param.get();
    277275 
    278276  if(!p)
     
    280278 
    281279  // skip to the parameter we want
    282   while (i++ < index && (p = p->next))
     280  while (i++ < index && (p = p->next.get()))
    283281    ;
    284282 
     
    289287
    290288  // Are there any subsequent parameters with the same name?
    291   while ((p = p->next))
     289  while ((p = p->next.get()))
    292290    if (p->name == name)
    293291      return Identifier::null();
Note: See TracChangeset for help on using the changeset viewer.