Skip to content

Commit

Permalink
fix: macos build
Browse files Browse the repository at this point in the history
It has been failing due to OVERFLOW constant, which is predefined
as a define macro on MacOS.

Signed-off-by: Roman Gershman <[email protected]>
  • Loading branch information
romange committed Oct 12, 2024
1 parent e71f083 commit 95069eb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/server/bitops_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1011,20 +1011,20 @@ nonstd::expected<CommonAttributes, std::string> ParseCommonAttr(CmdArgParser* pa
// Returns the CommandList if the parsing completed succefully or std::string
// to indicate an error
nonstd::expected<CommandList, std::string> ParseToCommandList(CmdArgList args, bool read_only) {
enum class Cmds { OVERFLOW, GET, SET, INCRBY };
enum class Cmds { OVERFLOW_OPT, GET_OPT, SET_OPT, INCRBY_OPT };
CommandList result;

using nonstd::make_unexpected;

CmdArgParser parser(args);
while (parser.HasNext()) {
auto cmd = parser.MapNext("OVERFLOW", Cmds::OVERFLOW, "GET", Cmds::GET, "SET", Cmds::SET,
"INCRBY", Cmds::INCRBY);
auto cmd = parser.MapNext("OVERFLOW", Cmds::OVERFLOW_OPT, "GET", Cmds::GET_OPT, "SET",
Cmds::SET_OPT, "INCRBY", Cmds::INCRBY_OPT);
if (parser.Error()) {
return make_unexpected(kSyntaxErr);
}

if (cmd == Cmds::OVERFLOW) {
if (cmd == Cmds::OVERFLOW_OPT) {
if (read_only) {
make_unexpected("BITFIELD_RO only supports the GET subcommand");
}
Expand All @@ -1045,7 +1045,7 @@ nonstd::expected<CommandList, std::string> ParseToCommandList(CmdArgList args, b
}

auto attr = maybe_attr.value();
if (cmd == Cmds::GET) {
if (cmd == Cmds::GET_OPT) {
result.push_back(Command(Get(attr)));
continue;
}
Expand All @@ -1058,12 +1058,12 @@ nonstd::expected<CommandList, std::string> ParseToCommandList(CmdArgList args, b
if (parser.Error()) {
return make_unexpected(kSyntaxErr);
}
if (cmd == Cmds::SET) {
if (cmd == Cmds::SET_OPT) {
result.push_back(Command(Set(attr, value)));
continue;
}

if (cmd == Cmds::INCRBY) {
if (cmd == Cmds::INCRBY_OPT) {
result.push_back(Command(IncrBy(attr, value)));
continue;
}
Expand Down

0 comments on commit 95069eb

Please sign in to comment.