Skip to content
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

C++ Misc Cleanup: More override, std-header, std::make_* usage, .. #10012

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

sgothel
Copy link

@sgothel sgothel commented Sep 9, 2024

Summary

  • Use override for virtual function overrides (incl. dtor)
  • Use C++ std headers, e.g. cctype instead of ctype.h
  • Use global anonym namespace for system functions or std:: system functions, whichever is applicable
  • Use std::make_shared(..)
  • Use std::make_unique()
  • Use 'const' where applicable
  • Use pre-incr where applicable
  • Use typename where applicable
  • Drop redundant type conversions

Change-Id: Id844187c82fce3c6e9bceb512c07180705608ebc

Checklist

  • I have run make prettier-write and formatted the code.
  • All commits have Change-Id
  • I have run tests with make check
  • I have issued make run and manually verified that everything looks okay
  • Documentation (manuals or wiki) has been updated or is not required

- Use override for virtual function overrides (incl. dtor)
- Use C++ std headers, e.g. cctype instead of ctype.h
- Use global anonym namespace for system functions
  or std:: system functions, whichever is applicable
- Use std::make_shared<StreamSocket>(..)
- Use std::make_unique<Watchdog>()
- Use 'const' where applicable
- Use pre-incr where applicable
- Use typename where applicable
- Drop redundant type conversions

Signed-off-by: Sven Göthel <[email protected]>
Change-Id: Id844187c82fce3c6e9bceb512c07180705608ebc
@sgothel sgothel force-pushed the private/sgothel/cleanup_02 branch from 6d9ea3f to 718ad77 Compare September 9, 2024 07:52
@@ -1087,21 +1087,21 @@ std::shared_ptr<Socket> ServerSocket::accept()
const void *inAddr;
if (clientInfo.sin6_family == AF_INET)
{
auto ipv4 = (struct sockaddr_in *)&clientInfo;
struct sockaddr_in *ipv4 = (struct sockaddr_in *)&clientInfo;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could probably replace the c-style "struct sockaddrWhatever" with c++-style "sockaddrWhatever", but that's just an observation.

@caolanm caolanm merged commit 9d73307 into master Sep 9, 2024
14 checks passed
@caolanm caolanm deleted the private/sgothel/cleanup_02 branch September 9, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants