Skip to content

Commit

Permalink
Changed static to dynamic memory for segment buffer allocation.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlexSee committed Mar 25, 2018
1 parent 092e38e commit 1c2c8f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions sopang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@

using namespace std;

Sopang::Sopang()
{
dBuffer = new uint64_t[dBufferSize];
}

Sopang::~Sopang()
{
delete[] dBuffer;
}

const string *const *Sopang::parseTextArray(string text, unsigned *nSegments, unsigned **segmentSizes)
{
boost::trim(text);
Expand Down
5 changes: 4 additions & 1 deletion sopang.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ using namespace std;
class Sopang
{
public:
Sopang();
~Sopang();

static const string *const *parseTextArray(string text, unsigned *nSegments, unsigned **segmentSizes);
static vector<string> parsePatterns(string patternsStr);

Expand All @@ -26,7 +29,7 @@ class Sopang

static constexpr uint64_t allOnes = ~(0x0ULL);

uint64_t dBuffer[dBufferSize];
uint64_t *dBuffer;
uint64_t maskBuffer[maskBufferSize];
};

Expand Down

0 comments on commit 1c2c8f2

Please sign in to comment.