Skip to content

Commit 4101dd2

Browse files
committed
fix some format
1 parent 08c4f56 commit 4101dd2

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

source/module_base/intarray.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ IntArray::IntArray(const int d1,const int d2)
2222
bound3 = bound4 = bound5 = bound6 = 0;
2323
size = bound1 * bound2;
2424
ptr = new int[size];zero_out();
25-
assert( ptr != 0);
25+
assert( ptr != nullptr);
2626
++arrayCount;
2727
}
2828

@@ -36,7 +36,7 @@ IntArray::IntArray(const int d1,const int d2,const int d3)
3636
//set_new_handler(IntArrayAlloc);
3737
size = bound1 * bound2 * bound3 ; //* sizeof(float);
3838
ptr = new int[size];zero_out();
39-
assert(ptr != 0);
39+
assert(ptr != nullptr);
4040
++arrayCount;
4141
}
4242

@@ -51,7 +51,7 @@ IntArray::IntArray(const int d1,const int d2,const int d3,const int d4)
5151
//set_new_handler(IntArrayAlloc);
5252
size = bound1 * bound2 * bound3 * bound4 ; //* sizeof(float);
5353
ptr = new int[size];zero_out();
54-
assert(ptr != 0);
54+
assert(ptr != nullptr);
5555
++arrayCount;
5656
}
5757

@@ -67,7 +67,7 @@ IntArray::IntArray(const int d1,const int d2,const int d3,
6767
//set_new_handler(IntArrayAlloc);
6868
size = bound1 * bound2 * bound3 * bound4 * bound5;
6969
ptr = new int[size];zero_out();
70-
assert(ptr != 0);
70+
assert(ptr != nullptr);
7171
++arrayCount;
7272
}
7373

@@ -84,7 +84,7 @@ IntArray::IntArray(const int d1,const int d2,const int d3,
8484
//set_new_handler(IntArrayAlloc);
8585
size = bound1 * bound2 * bound3 * bound4 * bound5 * bound6;
8686
ptr = new int[size];zero_out();
87-
assert(ptr != 0);
87+
assert(ptr != nullptr);
8888
++arrayCount;
8989
}
9090

@@ -98,10 +98,10 @@ IntArray ::~IntArray()
9898

9999
void IntArray::freemem()
100100
{
101-
if(ptr!=NULL)
101+
if(ptr!= nullptr)
102102
{
103103
delete [] ptr;
104-
ptr = NULL;
104+
ptr = nullptr;
105105
}
106106
}
107107

@@ -111,7 +111,7 @@ void IntArray::create(const int d1,const int d2,const int d3,const int d4,const
111111
dim = 6;
112112
bound1 = d1;bound2 = d2;bound3 = d3;bound4 = d4;bound5 = d5;bound6 = d6;
113113
delete[] ptr; ptr = new int[size];
114-
assert(ptr != 0);zero_out();
114+
assert(ptr != nullptr);zero_out();
115115
}
116116

117117
void IntArray::create(const int d1,const int d2,const int d3,const int d4,const int d5)
@@ -120,7 +120,7 @@ void IntArray::create(const int d1,const int d2,const int d3,const int d4,const
120120
dim = 5;
121121
bound1 = d1;bound2 = d2;bound3 = d3;bound4 = d4;bound5 = d5;
122122
delete[] ptr; ptr = new int[size];
123-
assert(ptr != 0);zero_out();
123+
assert(ptr != nullptr);zero_out();
124124
}
125125

126126
void IntArray::create(const int d1,const int d2,const int d3,const int d4)
@@ -129,7 +129,7 @@ void IntArray::create(const int d1,const int d2,const int d3,const int d4)
129129
dim = 4;
130130
bound1 = d1;bound2 = d2;bound3 = d3;bound4 = d4;
131131
delete[] ptr; ptr = new int[size];
132-
assert(ptr != 0);zero_out();
132+
assert(ptr != nullptr);zero_out();
133133
}
134134

135135
void IntArray::create(const int d1,const int d2,const int d3)
@@ -138,7 +138,7 @@ void IntArray::create(const int d1,const int d2,const int d3)
138138
dim = 3;
139139
bound1 = d1;bound2 = d2;bound3 = d3;bound4 = 1;
140140
delete [] ptr;ptr = new int[size];
141-
assert(ptr != 0);zero_out();
141+
assert(ptr != nullptr);zero_out();
142142
}
143143

144144
void IntArray::create(const int d1, const int d2)
@@ -147,16 +147,22 @@ void IntArray::create(const int d1, const int d2)
147147
dim = 2;
148148
bound1 = d1;bound2 = d2;bound3 = bound4 = 1;
149149
delete[] ptr;ptr = new int[size];
150-
assert(ptr !=0 );zero_out();
150+
assert(ptr != nullptr );zero_out();
151151
}
152152

153153
//****************************
154154
// zeroes out the whole array
155155
//****************************
156156
void IntArray::zero_out(void)
157157
{
158-
if (size <= 0) return;
159-
for (int i = 0;i < size; i++) ptr[i] = 0;
158+
if (size <= 0)
159+
{
160+
return;
161+
}
162+
for (int i = 0;i < size; i++)
163+
{
164+
ptr[i] = 0;
165+
}
160166
return;
161167
}
162168

0 commit comments

Comments
 (0)