Skip to content

Use C++20 ends_with() for suffix checking in GatewaySupervisor#303

Merged
rrivera747 merged 2 commits intorrivera/slowStatusReceiveInvestigationfrom
copilot/sub-pr-299
Jan 27, 2026
Merged

Use C++20 ends_with() for suffix checking in GatewaySupervisor#303
rrivera747 merged 2 commits intorrivera/slowStatusReceiveInvestigationfrom
copilot/sub-pr-299

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

Addresses code review feedback to modernize string suffix checking in GatewaySupervisor.cc.

Changes

  • Replace manual character-by-character suffix comparison with C++20 std::string::ends_with("END---")
  • Remove redundant dumpStr.size() >= 6 check (handled internally by ends_with())
  • Introduce const reference to avoid repeated member access
  • Fix logic inversion: original incorrectly checked for suffix absence

Before:

if(remoteGatewayApp.config_dump.size() > 10 &&
   (remoteGatewayApp.config_dump[remoteGatewayApp.config_dump.size() - 1] != '-' ||
    remoteGatewayApp.config_dump[remoteGatewayApp.config_dump.size() - 2] != '-' ||
    // ... 4 more comparisons
    ))

After:

const std::string& dumpStr = remoteGatewayApp.config_dump;
if(dumpStr.size() > 10 && dumpStr.ends_with("END---"))

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: rrivera747 <107584474+rrivera747@users.noreply.github.com>
Copilot AI changed the title [WIP] Update C++20 solution to remove redundant condition Use C++20 ends_with() for suffix checking in GatewaySupervisor Jan 27, 2026
Copilot AI requested a review from rrivera747 January 27, 2026 15:06
@rrivera747 rrivera747 marked this pull request as ready for review January 27, 2026 15:25
@rrivera747 rrivera747 merged commit 2961280 into rrivera/slowStatusReceiveInvestigation Jan 27, 2026
@rrivera747 rrivera747 deleted the copilot/sub-pr-299 branch January 27, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants