mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 08:19:02 +00:00
Use delete[] to deallocate after new[] (#1107)
* Use delete[] to deallocate after new[] * Fixup formatting with git-clang-format
This commit is contained in:
@@ -69,31 +69,28 @@ C_host_memory_block<T>::C_host_memory_block()
|
|||||||
template < class T>
|
template < class T>
|
||||||
C_host_memory_block<T>::~C_host_memory_block()
|
C_host_memory_block<T>::~C_host_memory_block()
|
||||||
{
|
{
|
||||||
if (pData!=NULL) delete pData;
|
if (pData != NULL) delete[] pData;
|
||||||
num_elements = 0;
|
num_elements = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class T >
|
template < class T >
|
||||||
void C_host_memory_block<T>::Init(int num_elem, T & value)
|
void C_host_memory_block<T>::Init(int num_elem, T & value)
|
||||||
{
|
{
|
||||||
if (pData!=NULL) delete pData;
|
if (pData != NULL) delete[] pData;
|
||||||
pData= new T [num_elem];
|
pData = new T[num_elem];
|
||||||
for (int i=0; i<num_elem; i++)
|
for (int i = 0; i < num_elem; i++) pData[i] = value;
|
||||||
pData[i] = value;
|
|
||||||
|
|
||||||
num_elements= num_elem;
|
num_elements = num_elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class T >
|
template < class T >
|
||||||
void C_host_memory_block<T>::Init(int num_elem)
|
void C_host_memory_block<T>::Init(int num_elem)
|
||||||
{
|
{
|
||||||
if (pData!=NULL) delete pData;
|
if (pData != NULL) delete[] pData;
|
||||||
pData = new T [num_elem];
|
pData = new T[num_elem];
|
||||||
for (int i=0; i<num_elem; i++)
|
for (int i = 0; i < num_elem; i++) pData[i] = (T)i;
|
||||||
pData[i]= (T) i;
|
|
||||||
|
|
||||||
num_elements = num_elem;
|
|
||||||
|
|
||||||
|
num_elements = num_elem;
|
||||||
}
|
}
|
||||||
template < class T >
|
template < class T >
|
||||||
void C_host_memory_block<T>::Set_to_zero()
|
void C_host_memory_block<T>::Set_to_zero()
|
||||||
|
|||||||
Reference in New Issue
Block a user