parser: fix coverity issues found in snapshot 70858

This commit add fixes for issues found in coverity's snapshot 70858.
  - CID 323127:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
  - CID 323125:  Uninitialized members  (UNINIT_CTOR)

I'm also removing Novell, Inc. from the copyright notice added by a
copy-paste error, and an unused variable left over from debugging.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
Georgia Garcia 2023-09-13 10:24:35 -03:00
parent 909e330fd0
commit 35f25a251b
2 changed files with 4 additions and 6 deletions

View file

@ -12,8 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, contact Novell, Inc. or Canonical
* Ltd.
* along with this program; if not, contact Canonical Ltd.
*/
#ifndef __AA_BIGNUM_H
@ -29,10 +28,9 @@ class bignum
{
public:
std::vector<uint8_t> data;
uint64_t sad = 543;
uint8_t base;
bool negative = false;
bignum () {}
bignum () : base(0) {}
bignum (unsigned long val) {
if (val == 0)

View file

@ -882,7 +882,7 @@ static std::string generate_regex_range(bignum start, bignum end)
std::ostringstream result;
std::vector<std::pair<bignum, bignum>> regex_range;
int j;
regex_range = regex_range_generator(start, end);
regex_range = regex_range_generator(std::move(start), std::move(end));
for (auto &i: regex_range) {
bignum sstart = i.first;
bignum send = i.second;
@ -942,7 +942,7 @@ int convert_range(std::string& buffer, bignum start, bignum end)
pattern_t ptype;
int pos;
std::string regex_range = generate_regex_range(start, end);
std::string regex_range = generate_regex_range(std::move(start), std::move(end));
if (!regex_range.empty()) {
ptype = convert_aaregex_to_pcre(regex_range.c_str(), 0, glob_default, buffer, &pos);