renamed to PreAlloc instead of PreMalloc

This commit is contained in:
2023-07-20 14:28:50 +08:00
parent 09eec7e7df
commit 8bb5374ab1
6 changed files with 8 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ namespace hgl
/** /**
* 多线程环形数据流,用于随时被读或写的情况以及在多线程应用中同时被读与写的情况。 * 多线程环形数据流,用于随时被读或写的情况以及在多线程应用中同时被读与写的情况。
*/ */
template<typename T> class RingBuffer:protected ThreadMutex ///多线程环形数据流 template<typename T> class RingBuffer:protected ThreadMutex ///多线程环形数据流
{ {
protected: protected:

View File

@@ -606,7 +606,7 @@ namespace hgl
if(count<=0)return; if(count<=0)return;
with_list.PreMalloc(count); with_list.PreAlloc(count);
const KVData *sp=this->GetDataList(); const KVData *sp=this->GetDataList();
@@ -630,7 +630,7 @@ namespace hgl
if(count<=0)return; if(count<=0)return;
without_list.PreMalloc(count); without_list.PreAlloc(count);
const KVData *sp=this->GetDataList(); const KVData *sp=this->GetDataList();

View File

@@ -64,9 +64,9 @@ namespace hgl
* 在指定位置插入一个对象 * 在指定位置插入一个对象
*/ */
template<typename T> template<typename T>
void CusObjectList<T>::Insert(int index,const ItemPointer &obj) bool CusObjectList<T>::Insert(int index,const ItemPointer &obj)
{ {
List<T *>::Insert(index,obj); return List<T *>::Insert(index,obj);
} }
/** /**

View File

@@ -6,7 +6,7 @@
namespace hgl namespace hgl
{ {
template<typename T> template<typename T>
void Pool<T>::PreMalloc(int num,bool set_to_max_count) void Pool<T>::PreAlloc(int num,bool set_to_max_count)
{ {
if(num<=0)return; if(num<=0)return;

View File

@@ -44,7 +44,7 @@ namespace hgl
Pool(){alloc_count=0;history_max=0;max_count=0;} Pool(){alloc_count=0;history_max=0;max_count=0;}
virtual ~Pool()=default; virtual ~Pool()=default;
virtual void PreMalloc(int,bool set_to_max=false); ///<预分配空间 virtual void PreAlloc(int,bool set_to_max=false); ///<预分配空间
virtual int SetMaxCount(int); ///<设定最大数量限制 virtual int SetMaxCount(int); ///<设定最大数量限制

View File

@@ -32,7 +32,7 @@ namespace hgl
virtual ~SortedSets()=default; virtual ~SortedSets()=default;
void SetCount (int count){data_list.SetCount(count);} ///<指定数据数量,一般用于批量加载前的处理 void SetCount (int count){data_list.SetCount(count);} ///<指定数据数量,一般用于批量加载前的处理
void PreMalloc (int count){data_list.PreMalloc(count);} ///<预分配指定数量的数据空间 void PreAlloc (int count){data_list.PreAlloc(count);} ///<预分配指定数量的数据空间
const int Find (const T &)const; ///<查找数据位置,不存在返回-1 const int Find (const T &)const; ///<查找数据位置,不存在返回-1
const bool IsMember (const T &v)const{return(Find(v)!=-1);} ///<确认是否成员 const bool IsMember (const T &v)const{return(Find(v)!=-1);} ///<确认是否成员