cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsoref <...@git.apache.org>
Subject [GitHub] cordova-plugin-globalization pull request: BB10 implementation
Date Wed, 30 Jul 2014 18:28:09 GMT
Github user jsoref commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-globalization/pull/18#discussion_r15602661
  
    --- Diff: src/blackberry10/native/public/json_internalarray.inl ---
    @@ -0,0 +1,448 @@
    +// included by json_value.cpp
    +// everything is within Json namespace
    +
    +// //////////////////////////////////////////////////////////////////
    +// //////////////////////////////////////////////////////////////////
    +// //////////////////////////////////////////////////////////////////
    +// class ValueInternalArray
    +// //////////////////////////////////////////////////////////////////
    +// //////////////////////////////////////////////////////////////////
    +// //////////////////////////////////////////////////////////////////
    +
    +ValueArrayAllocator::~ValueArrayAllocator()
    +{
    +}
    +
    +// //////////////////////////////////////////////////////////////////
    +// class DefaultValueArrayAllocator
    +// //////////////////////////////////////////////////////////////////
    +#ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
    +class DefaultValueArrayAllocator : public ValueArrayAllocator
    +{
    +public: // overridden from ValueArrayAllocator
    +   virtual ~DefaultValueArrayAllocator()
    +   {
    +   }
    +
    +   virtual ValueInternalArray *newArray()
    +   {
    +      return new ValueInternalArray();
    +   }
    +
    +   virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other )
    +   {
    +      return new ValueInternalArray( other );
    +   }
    +
    +   virtual void destructArray( ValueInternalArray *array )
    +   {
    +      delete array;
    +   }
    +
    +   virtual void reallocateArrayPageIndex( Value **&indexes, 
    +                                          ValueInternalArray::PageIndex &indexCount,
    +                                          ValueInternalArray::PageIndex minNewIndexCount
)
    +   {
    +      ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;
    +      if ( minNewIndexCount > newIndexCount )
    +         newIndexCount = minNewIndexCount;
    +      void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
    +      if ( !newIndexes )
    +         throw std::bad_alloc();
    +      indexCount = newIndexCount;
    +      indexes = static_cast<Value **>( newIndexes );
    +   }
    +   virtual void releaseArrayPageIndex( Value **indexes, 
    +                                       ValueInternalArray::PageIndex indexCount )
    +   {
    +      if ( indexes )
    +         free( indexes );
    +   }
    +
    +   virtual Value *allocateArrayPage()
    +   {
    +      return static_cast<Value *>( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage
) );
    +   }
    +
    +   virtual void releaseArrayPage( Value *value )
    +   {
    +      if ( value )
    +         free( value );
    +   }
    +};
    +
    +#else // #ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
    +/// @todo make this thread-safe (lock when accessign batch allocator)
    --- End diff --
    
    sp: accessign


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message