Skip to content

Commit 44d09d2

Browse files
committed
stt: cleanup allocation of shared_ptr
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
1 parent cab5e5f commit 44d09d2

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/stt/src/flt/flute.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ static void readLUTfiles(LUT_TYPE LUT, NUMSOLN_TYPE numsoln)
7474
{
7575
unsigned char charnum[256], line[32], *linep, c;
7676
FILE *fpwv, *fprt;
77-
struct csoln* p;
7877
int d, i, j, k, kk, ns, nn;
7978

8079
for (i = 0; i <= 255; i++) {
@@ -118,8 +117,7 @@ static void readLUTfiles(LUT_TYPE LUT, NUMSOLN_TYPE numsoln)
118117
} else {
119118
fgetc(fpwv); // '\n'
120119
numsoln[d][k] = ns;
121-
p = new struct csoln[ns];
122-
(*LUT)[d][k] = std::shared_ptr<struct csoln[]>(p);
120+
auto p = std::make_shared<struct csoln[]>(ns);
123121
for (i = 1; i <= ns; i++) {
124122
linep = (unsigned char*) fgets((char*) line, 32, fpwv);
125123
p->parent = charnum[*(linep++)];
@@ -147,6 +145,7 @@ static void readLUTfiles(LUT_TYPE LUT, NUMSOLN_TYPE numsoln)
147145
#endif
148146
p++;
149147
}
148+
(*LUT)[d][k] = std::move(p);
150149
}
151150
}
152151
}

0 commit comments

Comments
 (0)