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

Cleanup of internal cluster error functions #93

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

bjosv
Copy link
Collaborator

@bjosv bjosv commented Sep 11, 2024

Add internal convenience functions to clear errors, and cleanup the internal SetError functions.
The error string for VALKEY_ERR_IO is set by the standalone API, so removing the handling for it in the cluster part.

src/cluster.c Outdated
Comment on lines 211 to 212
} else if (str == NULL) { /* No known usecase. Clear previous errstr. */
cc->errstr[0] = '\0';
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is never called, we should probably do an assert instead, right?

assert(str != NULL);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have gone through a bit more, and it should be safe to assert.
Keeping the if-check part in case of NDEBUG, which is set by CMake in release builds.

The error string for VALKEY_ERR_IO is set by the standalone API,
so removing the special handling for it.

Signed-off-by: Björn Svensson <[email protected]>
Comment on lines +205 to +206
assert(str != NULL);
if (str != NULL && str != cc->errstr) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Some redundant check there in if...

Suggested change
assert(str != NULL);
if (str != NULL && str != cc->errstr) {
assert(str != NULL);
if (str != cc->errstr) {

@bjosv bjosv merged commit fbbf80e into valkey-io:main Sep 13, 2024
31 checks passed
@bjosv bjosv deleted the cluster-error-refactor branch September 13, 2024 06:58
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