mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 00:14:44 +01:00
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:
parent
909e330fd0
commit
35f25a251b
2 changed files with 4 additions and 6 deletions
|
@ -12,8 +12,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, contact Novell, Inc. or Canonical
|
* along with this program; if not, contact Canonical Ltd.
|
||||||
* Ltd.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __AA_BIGNUM_H
|
#ifndef __AA_BIGNUM_H
|
||||||
|
@ -29,10 +28,9 @@ class bignum
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::vector<uint8_t> data;
|
std::vector<uint8_t> data;
|
||||||
uint64_t sad = 543;
|
|
||||||
uint8_t base;
|
uint8_t base;
|
||||||
bool negative = false;
|
bool negative = false;
|
||||||
bignum () {}
|
bignum () : base(0) {}
|
||||||
|
|
||||||
bignum (unsigned long val) {
|
bignum (unsigned long val) {
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
|
|
|
@ -882,7 +882,7 @@ static std::string generate_regex_range(bignum start, bignum end)
|
||||||
std::ostringstream result;
|
std::ostringstream result;
|
||||||
std::vector<std::pair<bignum, bignum>> regex_range;
|
std::vector<std::pair<bignum, bignum>> regex_range;
|
||||||
int j;
|
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) {
|
for (auto &i: regex_range) {
|
||||||
bignum sstart = i.first;
|
bignum sstart = i.first;
|
||||||
bignum send = i.second;
|
bignum send = i.second;
|
||||||
|
@ -942,7 +942,7 @@ int convert_range(std::string& buffer, bignum start, bignum end)
|
||||||
pattern_t ptype;
|
pattern_t ptype;
|
||||||
int pos;
|
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()) {
|
if (!regex_range.empty()) {
|
||||||
ptype = convert_aaregex_to_pcre(regex_range.c_str(), 0, glob_default, buffer, &pos);
|
ptype = convert_aaregex_to_pcre(regex_range.c_str(), 0, glob_default, buffer, &pos);
|
||||||
|
|
Loading…
Add table
Reference in a new issue