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

Big refactoring #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

elgeniusz
Copy link

Split code to API and implementation headers

It was really hard to find, at the first glance, the true API of
the project.

Restructuring the code to the interface and the implementation
headers shall help future users get on track faster.

Extend tests with conversion functions

Network to host and host to network functions are tested now. 

Refactor endianness.h

* All API functions have been moved to endianness.h.
* Postfix "_impl" has been added to the non public functions.
* Added missing POSIX htons, htonl, ntohl, ntohs functions.
* Macros have been reorder for readability.
* Replaced tabs with spaces.
* Enforced 80 characters line lenght limit.

@rofl0r
Copy link
Owner

rofl0r commented Jan 29, 2020

thanks for your interest in this project.

Restructuring the code to the interface and the implementation headers shall help future users get on track faster.

you seem to have solved this by having two distinct headers, but this defeats the purpose of having a single-file header...
if the API is insufficiently documented, i'd rather see the documentation improved.

Added missing POSIX htons, htonl, ntohl, ntohs functions.

i guess nothing speaks against that, given that you make proper use of the end_ prefix.

Replaced tabs with spaces.

personal style preference - i don't think we want to argue about this topic.

Enforced 80 characters line lenght limit.

this might add a little benefit at least, if it doesn't gratuitously make the code uglier.

Extend tests

thanks, this is a valuable contribution.

Network to host and host to network functions are tested now.
@elgeniusz elgeniusz force-pushed the big_refactoring branch 2 times, most recently from 75ed552 to cda5fbc Compare January 30, 2020 15:56
* All API functions have been moved to the top of endianness.h.
* Postfix "_impl" has been added to the non public functions.
* Added missing POSIX end_htons, end_htonl, end_ntohl, end_ntohs
  functions.
* Macros have been reorder for readability.
* Consistent tabs instead of spaces.
* Enforced 80 characters line length limit.
@elgeniusz
Copy link
Author

Restructuring the code to the interface and the implementation headers shall help future users get on track faster.

you seem to have solved this by having two distinct headers, but this defeats the purpose of having a single-file header...
if the API is insufficiently documented, i'd rather see the documentation improved.

DONE - I've moved API macros to the top of the header and removed the implementation header. Now the user clearly sees the API after opening the file for the first time.

Added missing POSIX htons, htonl, ntohl, ntohs functions.

i guess nothing speaks against that, given that you make proper use of the end_ prefix.

DONE - Fixed the commit message. Macros in the code already had a proper prefix.

Replaced tabs with spaces.

personal style preference - i don't think we want to argue about this topic.

DONE - Consistent tabs in all of the code base.

Enforced 80 characters line lenght limit.

this might add a little benefit at least, if it doesn't gratuitously make the code uglier.

DONE - There is only one place where this really changed anything, and I don't think it changes anything from the readability perspective (see endianness.h:169).

@rofl0r
Copy link
Owner

rofl0r commented Jan 31, 2020

DONE - I've moved API macros to the top of the header and removed the implementation header. Now the user clearly sees the API after opening the file for the first time.

so the additional _impl redirection layer is no longer actually needed, right ?

DONE - Consistent tabs in all of the code base.

i'd pretty much prefer no whitespace changes at all

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.

3 participants