-
Notifications
You must be signed in to change notification settings - Fork 1
reorganization of folders and refactoring #4
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
Open
khrushv
wants to merge
4
commits into
sergeyampo:master
Choose a base branch
from
khrushv:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // | ||
| // Created by khrushv on 13.06.2020. | ||
| // | ||
| #include "check_port.h" | ||
| #include <stdio.h> | ||
|
|
||
|
|
||
| int check_port(unsigned int* port) { | ||
| if (*port < 1024) { | ||
| printf("port lower than 1024 may not be free\n"); | ||
| return 1; | ||
| } | ||
| return 0; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // | ||
| // Created by khrushv on 13.06.2020. | ||
| // | ||
|
|
||
|
|
||
|
|
||
| #ifndef TCPSERVERCLIENT_SRC_LIB_CHECK_PORT_H_ | ||
| #define TCPSERVERCLIENT_SRC_LIB_CHECK_PORT_H_ | ||
|
|
||
| int check_port(unsigned int* port); | ||
|
|
||
| #endif //TCPSERVERCLIENT_SRC_LIB_CHECK_PORT_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // | ||
| // Created by khrushv on 14.06.2020. | ||
| // | ||
| #include <netinet/in.h> | ||
| #include "set_sockaddr_in.h" | ||
|
|
||
|
|
||
| void set_sockaddr_in(struct sockaddr_in* server, | ||
| short s_port, unsigned short port, unsigned long s_addr) { | ||
| server->sin_family = s_port; | ||
| server->sin_port = htons(port); | ||
| server->sin_addr.s_addr = s_addr; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // | ||
| // Created by khrushv on 14.06.2020. | ||
| // | ||
|
|
||
| #ifndef TCPSERVERCLIENT_SRC_LIB_SET_SOCKADDR_IN_H_ | ||
| #define TCPSERVERCLIENT_SRC_LIB_SET_SOCKADDR_IN_H_ | ||
| void set_sockaddr_in(struct sockaddr_in* server, | ||
| short s_port, unsigned short port, unsigned long s_addr); | ||
| #endif //TCPSERVERCLIENT_SRC_LIB_SET_SOCKADDR_IN_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // | ||
| // Created by khrushv on 13.06.2020. | ||
| // | ||
|
|
||
| #include "factorial.h" | ||
|
|
||
|
|
||
| uint64_t factorial(const uint64_t* n) { | ||
| uint64_t factorial = 1; | ||
| uint64_t r = *n; | ||
| for (uint64_t i = 2; i <= r; ++i) | ||
| factorial *= i; | ||
| return factorial; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // | ||
| // Created by khrushv on 13.06.2020. | ||
| // | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| #ifndef TCPSERVERCLIENT_SRC_SERVER_FACTORIAL_H_ | ||
| #define TCPSERVERCLIENT_SRC_SERVER_FACTORIAL_H_ | ||
|
|
||
| uint64_t factorial(const uint64_t* n); | ||
|
|
||
| #endif //TCPSERVERCLIENT_SRC_SERVER_FACTORIAL_H_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,4 +10,6 @@ | |
|
|
||
| unsigned int* handle_options(int, char**, struct option[], const int, int (* [])(unsigned int*)); | ||
|
|
||
| int check_tnum(unsigned int* tnum); | ||
|
Owner
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. In our codestyle we don't write a name of parameter in a header file |
||
|
|
||
| #endif //TCPSERVERCLIENT_SRC_SERVER_OPT_ARG_H_ | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
In a library directory we have libraries so, why don't you create a directory with check_callbacks and place here check_callbacks.h and build it as a library?
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.
Also, you didn't fix last problem, you've included ./ but not ../lib it's unnecessary if you'll make a library, you can just target_link_libraries(client STATIC CheckCallbacks)
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.
It's better to explicitly set utils folder and not forcing CMake looking for it!
target_include_directories(client PUBLIC ./ ./utils)