Skip to content

Commit

Permalink
INTERNAL: Remove unnecessary lines in the version check of get API
Browse files Browse the repository at this point in the history
  • Loading branch information
ing-eoking committed Jan 9, 2025
1 parent e31c51b commit dcb9958
Showing 1 changed file with 25 additions and 32 deletions.
57 changes: 25 additions & 32 deletions libmemcached/get.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,50 +56,43 @@

static inline bool mget_command_is_supported(memcached_st *ptr, memcached_server_write_instance_st instance)
{
if (instance->major_version == UINT8_MAX && instance->minor_version == UINT8_MAX)
{
return false;
}

/* mgets */
if (ptr->flags.support_cas)
{
if (instance->major_version != UINT8_MAX && instance->minor_version != UINT8_MAX)
if (instance->is_enterprise)
{
if (instance->is_enterprise)
{
/* >= 0.9.0-E */
if (instance->major_version > 0 || (instance->major_version == 0 && instance->minor_version >= 9))
{
return true;
}
}
else
/* >= 0.9.0-E */
if (instance->major_version > 0 || (instance->major_version == 0 && instance->minor_version >= 9))
return true;
}
else
{
/* >= 1.13.0 */
if (instance->major_version > 1 || (instance->major_version == 1 && instance->minor_version >= 13))
{
/* >= 1.13.0 */
if (instance->major_version > 1 || (instance->major_version == 1 && instance->minor_version >= 13))
{
return true;
}
return true;
}
}
}
/* mget */
else
{
if (instance->major_version != UINT8_MAX && instance->minor_version != UINT8_MAX)
if (instance->is_enterprise)
{
if (instance->is_enterprise)
{
/* >= 0.7.0-E */
if (instance->major_version > 0 || (instance->major_version == 0 && instance->minor_version >= 7))
{
return true;
}
}
else
{
/* >= 1.11.0 */
if (instance->major_version > 1 || (instance->major_version == 1 && instance->minor_version >= 11))
{
return true;
}
}
/* >= 0.7.0-E */
if (instance->major_version > 0 || (instance->major_version == 0 && instance->minor_version >= 7))
return true;
}
else
{
/* >= 1.11.0 */
if (instance->major_version > 1 || (instance->major_version == 1 && instance->minor_version >= 11))
return true;
}
}
return false;
Expand Down

0 comments on commit dcb9958

Please sign in to comment.