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 unused and superfluous code in src/vkutil.* #41

Merged
merged 8 commits into from
Jul 1, 2024
5 changes: 3 additions & 2 deletions src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#ifndef _WIN32
Expand Down Expand Up @@ -181,7 +182,7 @@
*
*/
void valkey_parse_cmd(struct cmd *r) {
ASSERT(r->cmd != NULL && r->clen > 0);
assert(r->cmd != NULL && r->clen > 0);
char *p = r->cmd;
char *end = r->cmd + r->clen;
uint32_t rnarg = 0; /* Number of args including cmd name */
Expand Down Expand Up @@ -310,7 +311,7 @@
r->key.len = arglen;

done:
ASSERT(r->type > CMD_UNKNOWN && r->type < CMD_SENTINEL);
assert(r->type > CMD_UNKNOWN && r->type < CMD_SENTINEL);

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-7, cmake-3.11 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-7, cmake-3.11 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-7, cmake-3.11 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-7, cmake-3.11 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="address"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="address"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="address"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="address"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="undefined"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="undefined"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="undefined"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="undefined"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="thread"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="thread"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="thread"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="thread"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="undefined"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="undefined"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="undefined"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="undefined"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="thread"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="thread"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="thread"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="thread"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="leak"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="leak"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="leak"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="leak"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="undefined"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="undefined"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="undefined"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="undefined"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="thread"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="thread"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="thread"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="thread"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="address"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="address"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="address"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="address"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="address"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="address"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="address"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer="address"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="leak"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="leak"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="leak"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="leak"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="undefined"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="undefined"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="undefined"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="undefined"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="leak"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="leak"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="leak"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="leak"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer=""]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="thread"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="thread"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="thread"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [clang-18, cmake-3.29 sanitizer="thread"]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="address"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="address"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="address"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / RelWithDebInfo-build [gcc-13, cmake-3.29 sanitizer="address"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-18, cmake-3.29 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-12, cmake-3.11 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-12, cmake-3.11 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-12, cmake-3.11 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [clang-12, cmake-3.11 sanitizer=""]

no member named 'type' in 'struct cmd'

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="leak"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="leak"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="leak"]

‘struct cmd’ has no member named ‘type’

Check failure on line 314 in src/command.c

View workflow job for this annotation

GitHub Actions / Release-build [gcc-13, cmake-3.29 sanitizer="leak"]

‘struct cmd’ has no member named ‘type’
r->result = CMD_PARSE_OK;
return;

Expand Down
9 changes: 3 additions & 6 deletions src/valkeycluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ static cluster_slot *cluster_slot_create(valkeyClusterNode *node) {
slot->node = node;

if (node != NULL) {
ASSERT(node->role == VALKEY_ROLE_MASTER);
assert(node->role == VALKEY_ROLE_MASTER);
if (node->slots == NULL) {
node->slots = listCreate();
if (node->slots == NULL) {
Expand Down Expand Up @@ -404,14 +404,14 @@ static valkeyClusterNode *node_get_with_slots(valkeyClusterContext *cc,
goto error;
}

if (port_elem->type != VALKEY_REPLY_INTEGER || port_elem->integer <= 0) {
if (port_elem->type != VALKEY_REPLY_INTEGER) {
__valkeyClusterSetError(cc, VALKEY_ERR_OTHER,
"Command(cluster slots) reply error: "
"node port is not integer.");
goto error;
}

if (!vk_valid_port((int)port_elem->integer)) {
if (port_elem->integer < 1 || port_elem->integer > UINT16_MAX) {
__valkeyClusterSetError(cc, VALKEY_ERR_OTHER,
"Command(cluster slots) reply error: "
"node port is not valid.");
Expand Down Expand Up @@ -660,9 +660,6 @@ static int cluster_master_slave_mapping_with_name(valkeyClusterContext *cc,
if (listAddNodeTail(node_old->slaves, node) == NULL) {
goto oom;
}

} else {
NOT_REACHED();
}
}

Expand Down
Loading
Loading