Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
marsevilspirit committed Jan 16, 2025
1 parent 886a3d4 commit f27731b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/kiwi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool KiwiDB::ParseArgs(int argc, char* argv[]) {
return false;
}
if (options_.GetConfigName().empty() && argc > 1 && argv[1] != nullptr) {
struct stat st {};
struct stat st{};
if (stat(argv[1], &st) == 0 && S_ISREG(st.st_mode) && ::access(argv[1], R_OK) == 0) {
options_.SetConfigName(argv[1]);
argc = argc - 1;
Expand Down
6 changes: 3 additions & 3 deletions src/net/epoll_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bool EpollEvent::Init() {
}

void EpollEvent::AddEvent(uint64_t id, int fd, int mask) {
struct epoll_event ev {};
struct epoll_event ev{};
ev.events = mask;
ev.data.u64 = id;
if (epoll_ctl(EvFd(), EPOLL_CTL_ADD, fd, &ev) == -1) {
Expand All @@ -61,7 +61,7 @@ void EpollEvent::EventPoll() {
}

void EpollEvent::AddWriteEvent(uint64_t id, int fd) {
struct epoll_event ev {};
struct epoll_event ev{};
ev.events = EVENT_WRITE;
ev.data.u64 = id;
if (mode_ & EVENT_MODE_READ) { // If it is a read multiplex, modify the event
Expand All @@ -77,7 +77,7 @@ void EpollEvent::AddWriteEvent(uint64_t id, int fd) {
}

void EpollEvent::DelWriteEvent(uint64_t id, int fd) {
struct epoll_event ev {};
struct epoll_event ev{};
ev.data.u64 = id;
if (mode_ & EVENT_MODE_READ) { // If it is a read multiplex, modify the event to rea
ev.events = EVENT_READ;
Expand Down
2 changes: 1 addition & 1 deletion src/net/kqueue_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void KqueueEvent::EventPoll() {
void KqueueEvent::EventRead() {
struct kevent events[eventsSize];
struct timespec *pTimeout = nullptr;
struct timespec timeout {};
struct timespec timeout{};
if (timer_) {
pTimeout = &timeout;
int waitInterval = static_cast<int>(timer_->Interval());
Expand Down
2 changes: 1 addition & 1 deletion src/net/listen_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const int ListenSocket::LISTENQ = 1024;
bool ListenSocket::REUSE_PORT = true;

int ListenSocket::OnReadable(const std::shared_ptr<Connection> &conn, std::string *readBuff) {
struct sockaddr_in clientAddr {};
struct sockaddr_in clientAddr{};
auto newConnFd = Accept(&clientAddr);
if (newConnFd == 0) {
ERROR("ListenSocket fd:{},Accept error:{}", Fd(), errno);
Expand Down
4 changes: 3 additions & 1 deletion src/net/timer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ int64_t Timer::AddTask(const std::shared_ptr<ITimerTask>& task) {
void Timer::RePushTask() {
for (const auto& task : list_) {
task->Next();
{ queue_.push(task); }
{
queue_.push(task);
}
}
list_.clear();
}
Expand Down
3 changes: 2 additions & 1 deletion src/storage/src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
# define TRACE(M, ...) fprintf(stderr, "[TRACE] (%s:%d) " M "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#else
# define TRACE(M, ...) \
{}
{ \
}
#endif // NDEBUG
2 changes: 1 addition & 1 deletion src/storage/src/options_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct MemberTypeInfo {
// http://en.cppreference.com/w/cpp/concept/StandardLayoutType
// https://gist.github.com/graphitemaster/494f21190bb2c63c5516
template <typename T1, typename T2>
inline int offset_of(T1 T2::*member) {
inline int offset_of(T1 T2::* member) {
static T2 obj;
return int(size_t(&(obj.*member)) - size_t(&obj));
}
Expand Down

0 comments on commit f27731b

Please sign in to comment.