Skip to content

Commit

Permalink
Remove redundant null checks, replace pointer arithmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake-Madden committed May 6, 2024
1 parent 02f0d25 commit ef8de8b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/cpp_i18n_review.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,8 @@ namespace i18n_check
const std::wstring definedTerm =
std::wstring(directiveStart, endOfDefinedTerm - directiveStart);

directiveStart = endOfDefinedTerm + 1;
while (directiveStart != nullptr && *directiveStart != 0 &&
directiveStart = std::next(endOfDefinedTerm, 1);
while (*directiveStart != 0 &&
(*directiveStart == L' ' || *directiveStart == L'\t' ||
*directiveStart == L'('))
{
Expand All @@ -682,7 +682,7 @@ namespace i18n_check
std::wstring(directiveStart, endOfPossibleFuncName - directiveStart)) !=
m_ctors_to_ignore.cend())
{
directiveStart = endOfPossibleFuncName + 1;
directiveStart = std::next(endOfPossibleFuncName, 1);
}
// #define'd variable followed by a quote? Process as a string variable then.
if (*directiveStart != 0 &&
Expand All @@ -701,8 +701,7 @@ namespace i18n_check
// example: #define VALUE height, #define VALUE 0x5
// No open parentheses after the defined value--then not a function.
// Just leave the end marker where it is (EOL) and gobble all of this up.
else if (directiveStart != nullptr &&
std::wstring_view{ directiveStart,
else if (std::wstring_view{ directiveStart,
static_cast<size_t>(end - directiveStart) }
.find(L'(') == std::wstring_view::npos)
{ /*no-op*/
Expand Down

0 comments on commit ef8de8b

Please sign in to comment.