Esempio n. 1
0
	/** free the blob's memory */
	FORCEINLINE void Free()
	{
		if (Capacity() > 0) {
			RawFree(&Hdr());
			InitEmpty();
		}
	}
Esempio n. 2
0
 /** free the blob's memory */
 inline void Free()
 {
     if (Capacity() > 0) {
         RawFree(&Hdr());
         InitEmpty();
     }
 }
Esempio n. 3
0
	/** reallocate blob data if needed */
	void SmartAlloc(size_t new_size)
	{
		if (Capacity() >= new_size) return;
		/* calculate minimum block size we need to allocate
		 * and ask allocation policy for some reasonable block size */
		new_size = AllocPolicy(header_size + new_size + tail_reserve);

		/* allocate new block and setup header */
		BlobHeader *tmp = RawAlloc(new_size);
		tmp->items = Length();
		tmp->capacity = new_size - (header_size + tail_reserve);

		/* copy existing data */
		if (tmp->items != 0)
			memcpy(tmp + 1, data, tmp->items);

		/* replace our block with new one */
		if (Capacity() > 0)
			RawFree(&Hdr());
		Init(tmp);
	}
Esempio n. 4
0
	/** return the number of valid data bytes in the blob */
	FORCEINLINE size_t Length() const
	{
		return Hdr().items;
	}
Esempio n. 5
0
	/** return reference to the actual blob size - used when the size needs to be modified */
	FORCEINLINE size_t& LengthRef()
	{
		return Hdr().items;
	}
Esempio n. 6
0
	/** return number of used items */
	FORCEINLINE int Size() const { return Hdr().m_num_items; }
Esempio n. 7
0
	/** return reference to number of used items */
	FORCEINLINE int& SizeRef() { return Hdr().m_num_items; }
Esempio n. 8
0
	/** return reference to the block reference counter */
	FORCEINLINE int& RefCnt() { return Hdr().m_ref_cnt; }
Esempio n. 9
0
	/** return reference to number of used items */
	FORCEINLINE uint& SizeRef() { return Hdr().items; }
Esempio n. 10
0
 /** return the number of valid data bytes in the blob */
 inline size_t Length() const
 {
     return Hdr().items;
 }
Esempio n. 11
0
 /** return reference to the actual blob size - used when the size needs to be modified */
 inline size_t& LengthRef()
 {
     return Hdr().items;
 }
Esempio n. 12
0
	/** return number of used items */
	inline uint Length() const { return Hdr().items; }
Esempio n. 13
0
	/** return reference to number of used items */
	inline uint& SizeRef() { return Hdr().items; }
Esempio n. 14
0
	/** return reference to the block reference counter */
	inline uint& RefCnt() { return Hdr().reference_count; }
Esempio n. 15
0
	/** return number of used items */
	FORCEINLINE uint Length() const { return Hdr().items; }
Esempio n. 16
0
	/** return the current blob capacity in bytes */
	FORCEINLINE size_t Capacity() const
	{
		return Hdr().capacity;
	}
Esempio n. 17
0
 /** return the current blob capacity in bytes */
 inline size_t Capacity() const
 {
     return Hdr().capacity;
 }
Esempio n. 18
0
	/** return reference to the block reference counter */
	FORCEINLINE uint& RefCnt() { return Hdr().reference_count; }