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

Refactor the parsing of a key in a command #37

Merged
merged 9 commits into from
Jul 1, 2024

Conversation

bjosv
Copy link
Collaborator

@bjosv bjosv commented Jun 28, 2024

The number of elements in the array of keys is either one or none in the command struct.
Remove the array and refactor the code after #23 was merged.

Additional changes:

  • Remove vkarray.c/.h
  • Remove unused remain_len from struct keypos
  • Remove unused remain_len from struct keypos
  • Remove unused reply from struct cmd
  • Remove unused quit and noforward from struct cmd
  • Remove unused command type from struct cmd
  • Remove unused id from struct cmd
  • Remove unused narg from struct cmd
  • Remove unused frag_seq from struct cmd

bjosv added 8 commits June 28, 2024 12:38
Signed-off-by: Björn Svensson <[email protected]>
Signed-off-by: Björn Svensson <[email protected]>
The number of elements in the array of keys is either one or none
in the command struct. Remove the array and refactor the code.
Use the length of the keypos to determine if found.

Signed-off-by: Björn Svensson <[email protected]>
Copy link
Collaborator

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

This is a massive cleanup! ⭐ ⭐ ⭐

@@ -36,12 +36,9 @@
#include <stdint.h>
#include <sys/types.h>

#define VK_OK 0
#define VK_ERROR -1
#define VK_EAGAIN -2
Copy link
Collaborator

Choose a reason for hiding this comment

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

How come OK is deleted by the errors remain? Does any function return OK | ERROR?

Copy link
Collaborator Author

@bjosv bjosv Jul 1, 2024

Choose a reason for hiding this comment

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

There is no use of VK_ERROR in src/, only VK_OK.
The plan was to remove a lot of unused code in a separate PR. This is now done in #41.

@bjosv bjosv merged commit ac09913 into valkey-io:main Jul 1, 2024
42 of 43 checks passed
@bjosv bjosv deleted the refactor-command-code branch July 1, 2024 10:55
michael-grunder pushed a commit to michael-grunder/libvalkey that referenced this pull request Aug 1, 2024
The number of elements in the array of keys is either one or none in the
command struct, so this change removes the array and refactors the code.

Additional changes:
- Remove `vkarray.c/.h`
- Remove unused `remain_len` from `struct keypos`
- Remove unused `remain_len` from `struct keypos`
- Remove unused `reply` from `struct cmd`
- Remove unused `quit` and `noforward` from `struct cmd`
- Remove unused command `type` from `struct cmd`
- Remove unused `id` from `struct cmd`
- Remove unused `narg` from `struct cmd`
- Remove unused `frag_seq` from `struct cmd`

Signed-off-by: Björn Svensson <[email protected]>
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