-
Notifications
You must be signed in to change notification settings - Fork 16
fix: edge cases parsing of DD_TAGS
#233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,11 +141,10 @@ Expected<std::unordered_map<std::string, std::string>> parse_tags( | |
|
|
||
| if (separator == std::string::npos) { | ||
| key = std::string{trim(token)}; | ||
| if (key.empty()) continue; | ||
| } else { | ||
| key = std::string{trim(token.substr(0, separator))}; | ||
| if (key.empty()) { | ||
| continue; | ||
| } | ||
| if (key.empty()) continue; | ||
| value = std::string{trim(token.substr(separator + 1))}; | ||
| } | ||
|
|
||
|
|
@@ -183,15 +182,14 @@ Expected<std::unordered_map<std::string, std::string>> parse_tags( | |
| break; | ||
| } else if (input[i] == ' ') { | ||
| separator = ' '; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| if (separator == 0) { | ||
| goto capture_all; | ||
| } | ||
|
|
||
| for (; i < end; ++i) { | ||
| for (i = beg; i < end; ++i) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we put i = 0 instead ? I'm almost sure that beg is 0 at this time and it makes the code a slightly more readable
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sens. Unfortunately, this PR has been opened for too long, and revisiting it for a nit is not a priority. However, please don’t hesitate to open a new PR if you'd like to revisit or continue the work |
||
| if (input[i] == separator) { | ||
| auto tag = input.substr(beg, i - beg); | ||
| if (tag.size() > 0) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be interesting to ignore the key with no value ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's done in
parse_tagsl.210There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry my comment was obviously wrong, to ignore the value with empty value*