mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-03 17:56:12 -04:00
refactor: replace more instances of memset
with zero-initialization
This commit is contained in:
parent
9996748134
commit
918bfa6467
@ -515,8 +515,7 @@ void fatal_signal_handler_posix(int signal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!signame) {
|
if (!signame) {
|
||||||
struct ::sigaction sa_dfl;
|
struct ::sigaction sa_dfl{};
|
||||||
::memset(&sa_dfl, 0, sizeof(sa_dfl));
|
|
||||||
sa_dfl.sa_handler = SIG_DFL;
|
sa_dfl.sa_handler = SIG_DFL;
|
||||||
::sigaction(signal, &sa_dfl, nullptr);
|
::sigaction(signal, &sa_dfl, nullptr);
|
||||||
signame = std::to_string(signal);
|
signame = std::to_string(signal);
|
||||||
@ -538,8 +537,7 @@ void install_signal_handlers_impl() {
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
::signal(kFatalSignals[i].signum, fatal_signal_handler_win);
|
::signal(kFatalSignals[i].signum, fatal_signal_handler_win);
|
||||||
#else
|
#else
|
||||||
struct ::sigaction new_sa;
|
struct ::sigaction new_sa{};
|
||||||
::memset(&new_sa, 0, sizeof(new_sa));
|
|
||||||
// this is potentially implemented as a macro
|
// this is potentially implemented as a macro
|
||||||
sigfillset(&new_sa.sa_mask);
|
sigfillset(&new_sa.sa_mask);
|
||||||
new_sa.sa_handler = fatal_signal_handler_posix;
|
new_sa.sa_handler = fatal_signal_handler_posix;
|
||||||
|
@ -417,9 +417,8 @@ bool filesystem_extractor_<LoggerPolicy>::extract(
|
|||||||
auto ae = ::archive_entry_new();
|
auto ae = ::archive_entry_new();
|
||||||
auto stbuf = fs.getattr(inode);
|
auto stbuf = fs.getattr(inode);
|
||||||
|
|
||||||
struct stat st;
|
struct stat st{};
|
||||||
|
|
||||||
::memset(&st, 0, sizeof(st));
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
stbuf.copy_to_without_block_info(&st);
|
stbuf.copy_to_without_block_info(&st);
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user