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

added prival function #323

Closed
wants to merge 11 commits into from
Closed

added prival function #323

wants to merge 11 commits into from

Conversation

mk722
Copy link

@mk722 mk722 commented Jan 4, 2023

added function stumpless_get_prival_string

@goatshriek goatshriek marked this pull request as draft January 5, 2023 01:02
Copy link
Owner

@goatshriek goatshriek left a comment

Choose a reason for hiding this comment

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

It looks like you're making good progress! I've left some specific comments for you in the review. In addition to those, here are some more general points:

  • make sure that you add your new .c file to the CMakeLists.txt file (in the STUMPLESS_SOURCES list) so that it is included during compilation.
  • You'll need to add an entry into src/windows/stumpless.def with your new function so that it is usable from Windows systems.
  • You'll need to add your new function name to tools/check_headers/stumpless.yml as well so that it is used during header checks.

include/stumpless/prival.h Show resolved Hide resolved
include/stumpless/prival.h Outdated Show resolved Hide resolved
include/stumpless/prival.h Show resolved Hide resolved
src/prival.c Outdated Show resolved Hide resolved
@goatshriek goatshriek linked an issue Jan 5, 2023 that may be closed by this pull request
@mk722
Copy link
Author

mk722 commented Jan 5, 2023

Thank for review. I little edited function stumpless_get_prival_string . I add a option NoSuchPrival, when int prival is not valid parameter, so severity and facility can not be valid too. I am not sure, if it is absolutely necessary, but it is there now. I also edited other files, like CMake and another you mentioned. I write a test, but there I am not sure if it is enough, or some another need to be done.

@mk722 mk722 requested a review from goatshriek January 6, 2023 17:02
@goatshriek
Copy link
Owner

It looks like there are some compilation issues, as well as unused includes in the new prival.h header. Once you get a build working locally, submit a fresh commit and we'll see if it gets further on the CI tests.

CMakeLists.txt Outdated
@@ -1218,6 +1220,10 @@ add_function_test(perror
SOURCES test/function/startup/perror.cpp
)

add_function_test(facility
Copy link
Owner

Choose a reason for hiding this comment

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

you'll need to change the name of this test from facility to something unique (probably prival is the best choice) in order for CMake to work properly.

# define __STUMPLESS_PRIVAL_H

# include <stumpless/config.h>
# include <stumpless/generator.h>
Copy link
Owner

Choose a reason for hiding this comment

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

use the header check tool (or the results of the Static Analysis CI check) to identify which include statements aren't needed - this one is unneeded at a minimum.

TEST( GetPrivalString, ValidPrival ) {
const char *result;

#define CHECK_PRIVAL_TRUE( STRING, INT ) \
Copy link
Owner

Choose a reason for hiding this comment

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

this is just a #define, and doesn't appear to actually run any tests?

@mk722 mk722 requested a review from goatshriek January 6, 2023 22:27
@mk722
Copy link
Author

mk722 commented Jan 6, 2023

I made the changes you described, please check.

@goatshriek
Copy link
Owner

goatshriek commented Jan 6, 2023

You are on a good path, but there are still some compilation issues that you will need to work through locally. Make sure that you can build the code and run the tests on your own machine before pushing to this PR.

Also, be careful with your pointers: the code as is will cause a segfault, as it writes into a pointer that has not been set to a valid address. You'll need to allocate memory via alloc_mem for this. You can find many examples of this throughout the code base, for example in src/param.c.

@mk722 mk722 marked this pull request as ready for review January 8, 2023 18:42
Copy link
Owner

@goatshriek goatshriek left a comment

Choose a reason for hiding this comment

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

Compilation errors persist.

@mk722 mk722 requested a review from goatshriek January 8, 2023 20:09
@mk722
Copy link
Author

mk722 commented Jan 8, 2023

I fixed memory and other things, now should build run well.

@mk722
Copy link
Author

mk722 commented Jan 8, 2023

Can you please launch test again? I pushed two commits but and it tested not the last one, but the one, whitch I was pushed just moment before it.

src/prival.c Fixed Show fixed Hide fixed
@mk722
Copy link
Author

mk722 commented Jan 9, 2023

I fix test, which causes an error. Can you please run tests again?

@mk722
Copy link
Author

mk722 commented Jan 9, 2023

I added heading file, which was missing in test, can you try launch test now? Thanks.

@goatshriek
Copy link
Owner

I've gotten the ANSI-only build support to a state where the library and tests compile, though the network tests and some static analysis still fails at the moment. Please merge in the ansi-only-build branch so that you can locally compile and run test cases without using the CI.

@goatshriek
Copy link
Owner

Checking in to see if you intend to continue work on this, per the contribution guidelines.

@goatshriek goatshriek added the stale inactive issue or pull request label Mar 27, 2023
@goatshriek goatshriek closed this May 4, 2023
@goatshriek
Copy link
Owner

Closed as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale inactive issue or pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

prival to string function
2 participants