[webkit-changes] cvs commit: JavaScriptCore/kjs collector.cpp property_map.cpp ustring.cpp

Darin darin at opensource.apple.com
Sun Jul 31 22:02:14 PDT 2005


darin       05/07/31 22:02:14

  Modified:    .        ChangeLog
               kjs      collector.cpp property_map.cpp ustring.cpp
  Log:
          Reviewed by Maciej.
  
          - remove uses of Mac-OS-X-specific MAX macro
          - remove one of the many excess "APPLE_CHANGES" ifdefs
  
          * kjs/collector.cpp: (KJS::Collector::allocate): Use std::max instead of MAX.
          * kjs/property_map.cpp: (KJS::PropertyMap::rehash): Ditto.
          * kjs/ustring.cpp:
          (KJS::UChar::toLower): Take out non-ICU code path.
          (KJS::UChar::toUpper): Ditto.
          (KJS::UString::spliceSubstringsWithSeparators): Use std::max instead of MAX.
  
  Revision  Changes    Path
  1.771     +14 -0     JavaScriptCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
  retrieving revision 1.770
  retrieving revision 1.771
  diff -u -r1.770 -r1.771
  --- ChangeLog	27 Jul 2005 23:44:49 -0000	1.770
  +++ ChangeLog	1 Aug 2005 05:02:11 -0000	1.771
  @@ -1,3 +1,17 @@
  +2005-07-31  Darin Adler  <darin at apple.com>
  +
  +        Reviewed by Maciej.
  +
  +        - remove uses of Mac-OS-X-specific MAX macro
  +        - remove one of the many excess "APPLE_CHANGES" ifdefs
  +
  +        * kjs/collector.cpp: (KJS::Collector::allocate): Use std::max instead of MAX.
  +        * kjs/property_map.cpp: (KJS::PropertyMap::rehash): Ditto.
  +        * kjs/ustring.cpp:
  +        (KJS::UChar::toLower): Take out non-ICU code path.
  +        (KJS::UChar::toUpper): Ditto.
  +        (KJS::UString::spliceSubstringsWithSeparators): Use std::max instead of MAX.
  +
   2005-07-27  Geoffrey Garen  <ggaren at apple.com>
   
           - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4147
  
  
  
  1.40      +6 -2      JavaScriptCore/kjs/collector.cpp
  
  Index: collector.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/collector.cpp,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- collector.cpp	14 Jul 2005 18:27:01 -0000	1.39
  +++ collector.cpp	1 Aug 2005 05:02:12 -0000	1.40
  @@ -26,6 +26,8 @@
   #include "list.h"
   #include "value.h"
   
  +#include <algorithm>
  +
   #if APPLE_CHANGES
   #include <CoreFoundation/CoreFoundation.h>
   #include <pthread.h>
  @@ -34,6 +36,8 @@
   #include <mach/thread_act.h>
   #endif
   
  +using std::max;
  +
   namespace KJS {
   
   // tunable parameters
  @@ -101,7 +105,7 @@
     if (s > static_cast<size_t>(CELL_SIZE)) {
       // oversize allocator
       if (heap.usedOversizeCells == heap.numOversizeCells) {
  -      heap.numOversizeCells = MAX(MIN_ARRAY_SIZE, heap.numOversizeCells * GROWTH_FACTOR);
  +      heap.numOversizeCells = max(MIN_ARRAY_SIZE, heap.numOversizeCells * GROWTH_FACTOR);
         heap.oversizeCells = (CollectorCell **)kjs_fast_realloc(heap.oversizeCells, heap.numOversizeCells * sizeof(CollectorCell *));
       }
       
  @@ -131,7 +135,7 @@
       // didn't find one, need to allocate a new block
       
       if (heap.usedBlocks == heap.numBlocks) {
  -      heap.numBlocks = MAX(MIN_ARRAY_SIZE, heap.numBlocks * GROWTH_FACTOR);
  +      heap.numBlocks = max(MIN_ARRAY_SIZE, heap.numBlocks * GROWTH_FACTOR);
         heap.blocks = (CollectorBlock **)kjs_fast_realloc(heap.blocks, heap.numBlocks * sizeof(CollectorBlock *));
       }
       
  
  
  
  1.43      +5 -1      JavaScriptCore/kjs/property_map.cpp
  
  Index: property_map.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/property_map.cpp,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- property_map.cpp	14 Jul 2005 18:27:03 -0000	1.42
  +++ property_map.cpp	1 Aug 2005 05:02:12 -0000	1.43
  @@ -26,6 +26,10 @@
   #include "protect.h"
   #include "reference_list.h"
   
  +#include <algorithm>
  +
  +using std::max;
  +
   #define DEBUG_PROPERTIES 0
   #define DO_CONSISTENCY_CHECK 0
   #define DUMP_STATISTICS 0
  @@ -412,7 +416,7 @@
                   key->deref();
               else {
                   int index = entry.index;
  -                lastIndexUsed = MAX(index, lastIndexUsed);
  +                lastIndexUsed = max(index, lastIndexUsed);
                   insert(key, entry.value, entry.attributes, index);
               }
           }
  
  
  
  1.58      +4 -19     JavaScriptCore/kjs/ustring.cpp
  
  Index: ustring.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/ustring.cpp,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- ustring.cpp	14 Jul 2005 18:27:03 -0000	1.57
  +++ ustring.cpp	1 Aug 2005 05:02:13 -0000	1.58
  @@ -42,11 +42,11 @@
   #include <math.h>
   #include "dtoa.h"
   
  -#if APPLE_CHANGES
  +#include <algorithm>
   
  -#include <unicode/uchar.h>
  +using std::max;
   
  -#endif
  +#include <unicode/uchar.h>
   
   namespace KJS {
   
  @@ -149,27 +149,12 @@
   
   UChar UChar::toLower() const
   {
  -#if APPLE_CHANGES
     return static_cast<unsigned short>(u_tolower(uc));
  -#else
  -  // ### properly support unicode tolower
  -  if (uc >= 256 || islower(uc))
  -    return *this;
  -
  -  return (unsigned char)tolower(uc);
  -#endif
   }
   
   UChar UChar::toUpper() const
   {
  -#if APPLE_CHANGES
     return static_cast<unsigned short>(u_toupper(uc));
  -#else
  -  if (uc >= 256 || isupper(uc))
  -    return *this;
  -
  -  return (unsigned char)toupper(uc);
  -#endif
   }
   
   UCharReference& UCharReference::operator=(UChar c)
  @@ -640,7 +625,7 @@
   
     UChar *buffer = static_cast<UChar *>(kjs_fast_malloc(totalLength * sizeof(UChar)));
   
  -  int maxCount = MAX(rangeCount, separatorCount);
  +  int maxCount = max(rangeCount, separatorCount);
     int bufferPos = 0;
     for (int i = 0; i < maxCount; i++) {
       if (i < rangeCount) {
  
  
  



More information about the webkit-changes mailing list