Ignore:
Timestamp:
Jan 19, 2006, 12:59:03 AM (19 years ago)
Author:
darin
Message:

Reviewed by Hyatt.

  • hash table fixes needed for my WebCore changes
  • kxmlcore/HashTable.h: (KXMLCore::HashTableConstIterator::operator=): Added a missing return statement.
  • kxmlcore/HashTraits.h: Fix traits so they work properly for classes where you can't instantiate with a 0 by using traits rather than ? : to select the default emtpy value of hash table keys.
  • small cleanup of "runtime" code left over from recent JavaScript crash fix
  • bindings/runtime_root.h: (KJS::Bindings::RootObject::RootObject): No explicit initialization of _imp needed since it's now a ProtectedPtr. (KJS::Bindings::RootObject::setRootObjectImp): Remove old code that relied on the fact that _imp was 0 and replaced with use of ProtectedPtr. (KJS::Bindings::RootObject::rootObjectImp): Updated since _imp is a ProtectedPtr.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kxmlcore/HashTraits.h

    r12162 r12232  
    4545    template <> struct IsInteger<unsigned long long> { static const bool value = true; };
    4646
    47     template<typename T> struct GenericHashTraits {
     47    template<bool isInteger, typename T> struct GenericHashTraitsBase;
     48    template<typename T> struct GenericHashTraitsBase<true, T> {
    4849        typedef T TraitType;
    49         static const bool emptyValueIsZero = IsInteger<T>::value;
    50         static const bool needsDestruction = !IsInteger<T>::value;
    51         static TraitType emptyValue() { return IsInteger<T>::value ? 0 : TraitType(); }
     50        static const bool emptyValueIsZero = true;
     51        static const bool needsDestruction = false;
     52        static TraitType emptyValue() { return 0; }
    5253    };
     54    template<typename T> struct GenericHashTraitsBase<false, T> {
     55        typedef T TraitType;
     56        static const bool emptyValueIsZero = false;
     57        static const bool needsDestruction = true;
     58        static TraitType emptyValue() { return TraitType(); }
     59    };
     60
     61    template<typename T> struct GenericHashTraits : GenericHashTraitsBase<IsInteger<T>::value, T> { };
    5362
    5463    template<typename T> struct HashTraits : GenericHashTraits<T> { };
Note: See TracChangeset for help on using the changeset viewer.