Skip to content

Commit 2f4280a

Browse files
authored
signature attribute; small cleanup (#1187)
1 parent 6eac779 commit 2f4280a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/attributes.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,11 @@ namespace attributes {
400400
Param sigParam = paramNamed(kExportSignature);
401401
std::string sig = sigParam.value();
402402
trimWhitespace(&sig);
403+
if(sig.empty()) return sig;
403404
if(sig.back() == '}')
404405
sig = sig.substr(0, sig.size()-1);
406+
// check sig.empty again since we deleted an element
407+
if(sig.empty()) return sig;
405408
if(sig.front() == '{')
406409
sig.erase(0,1);
407410
return sig;
@@ -1444,8 +1447,8 @@ namespace attributes {
14441447
const std::string delimiters(",");
14451448
std::vector<Param> params;
14461449
std::string::size_type current;
1447-
std::string::size_type next = -1;
1448-
std::string::size_type signature_param_start = -1;
1450+
std::string::size_type next = std::string::npos;
1451+
std::string::size_type signature_param_start = std::string::npos;
14491452
do { // #nocov
14501453
next = input.find_first_not_of(delimiters, next + 1);
14511454
if (next == std::string::npos)
@@ -1463,7 +1466,7 @@ namespace attributes {
14631466

14641467
// if the signature param was found, then check that the name,
14651468
// start block and end block exist and are in the correct order
1466-
if(signature_param_start != static_cast<std::string::size_type>(-1)) {
1469+
if(signature_param_start != std::string::npos) {
14671470
bool sigchecks =
14681471
signature_param_start < blockstart &&
14691472
blockstart < blockend &&

0 commit comments

Comments
 (0)