Skip to content

Commit

Permalink
Fix minor issues (#592)
Browse files Browse the repository at this point in the history
* function missing [[noreturn]]
* semi-colon after function block
* double semi-colon after expression
* missing prototype
* parameter in documentation not matching parameter in function
* unused variable

Signed-off-by: Ted Lyngmo <ted@lyncon.se>
  • Loading branch information
TedLyngmo committed Sep 16, 2024
1 parent 3cca0f1 commit fd95870
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/sw/redis++/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class Connection {
if (context != nullptr) {
redisFree(context);
}
};
}
};

using ContextUPtr = std::unique_ptr<redisContext, ContextDeleter>;
Expand Down
1 change: 1 addition & 0 deletions src/sw/redis++/crc16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
* Output for "123456789" : 31C3
*/

#include "utils.h"
#include <cstdint>

namespace sw {
Expand Down
4 changes: 2 additions & 2 deletions src/sw/redis++/errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace sw {

namespace redis {

void throw_error(const redisContext &context, const std::string &err_info) {
[[noreturn]] void throw_error(const redisContext &context, const std::string &err_info) {
auto err_code = context.err;
const auto *err_str = context.errstr;
if (err_str == nullptr) {
Expand Down Expand Up @@ -78,7 +78,7 @@ void throw_error(const redisContext &context, const std::string &err_info) {
}
}

void throw_error(const redisReply &reply) {
[[noreturn]] void throw_error(const redisReply &reply) {
assert(reply.type == REDIS_REPLY_ERROR);

if (reply.str == nullptr) {
Expand Down
4 changes: 2 additions & 2 deletions src/sw/redis++/errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ class MovedError;

class AskError;

void throw_error(const redisContext &context, const std::string &err_info);
[[noreturn]] void throw_error(const redisContext &context, const std::string &err_info);

void throw_error(const redisReply &reply);
[[noreturn]] void throw_error(const redisReply &reply);

template <typename Input>
inline void range_check(const char *cmd, Input first, Input last) {
Expand Down
7 changes: 3 additions & 4 deletions src/sw/redis++/redis.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ class Redis {
/// @see https://redis.io/commands/expireat
bool expireat(const StringView &key,
const std::chrono::time_point<std::chrono::system_clock,
std::chrono::seconds> &tp);
std::chrono::seconds> &timestamp);

/// @brief Get keys matching the given pattern.
/// @param pattern Pattern.
Expand Down Expand Up @@ -421,7 +421,7 @@ class Redis {
/// @see https://redis.io/commands/pexpireat
bool pexpireat(const StringView &key,
const std::chrono::time_point<std::chrono::system_clock,
std::chrono::milliseconds> &tp);
std::chrono::milliseconds> &timestamp);

/// @brief Get the TTL of a key in milliseconds.
/// @param key Key.
Expand Down Expand Up @@ -2202,8 +2202,7 @@ class Redis {
/// redis.zadd("zset", {std::make_pair("m1", 1.4), std::make_pair("m2", 2.3)});
/// @endcode
/// @param key Key where the sorted set is stored.
/// @param first Iterator to the first member-score pair.
/// @param last Off-the-end iterator to the member-score pairs range.
/// @param il Initializer list of member-score pairs.
/// @param type Options for zadd command:
/// - UpdateType::EXIST: Add the member only if it already exists.
/// - UpdateType::NOT_EXIST: Add the member only if it does not exist.
Expand Down
2 changes: 1 addition & 1 deletion src/sw/redis++/reply.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ Cursor parse_scan_reply(redisReply &reply, Output output) {
Cursor new_cursor = 0;
try {
new_cursor = std::stoull(cursor_str);
} catch (const std::exception &e) {
} catch (const std::exception &) {
throw ProtoError("Invalid cursor reply: " + cursor_str);
}

Expand Down
2 changes: 1 addition & 1 deletion src/sw/redis++/sentinel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Connection Sentinel::slave(const std::string &master_name, const ConnectionOptio
}
} catch (const StopIterError &err) {
err_msgs.push_back(report_error(sentinel_node, slave_node, err.what()));
throw StopIterError(err_msgs);;
throw StopIterError(err_msgs);
} catch (const Error &err) {
err_msgs.push_back(report_error(sentinel_node, slave_node, err.what()));
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/sw/redis++/shards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ std::pair<Slot, Node> RedirectionError::_parse_error(const std::string &msg) con
auto port = std::stoi(msg.substr(colon_pos + 1));

return {slot, {host, port}};
} catch (const std::exception &e) {
} catch (const std::exception &) {
throw ProtoError("Invalid ASK error message: " + msg);
}
}
Expand Down

0 comments on commit fd95870

Please sign in to comment.