1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-16 18:15:17 +00:00

core, logging: remove clean_up_without_threads and simplify clean_up

This commit is contained in:
bi4k8 2023-05-05 01:02:35 +00:00 committed by bi4k8
parent 863bd2441b
commit 19e779cdf9
3 changed files with 9 additions and 14 deletions

View File

@ -1828,7 +1828,7 @@ void main_loop() {
llua_update_info(&info, active_update_interval());
}
clean_up(nullptr, nullptr);
clean_up();
#ifdef HAVE_SYS_INOTIFY_H
if (inotify_fd != -1) {
@ -1850,7 +1850,7 @@ static void reload_config() {
current_config.c_str(), getpid());
return;
}
clean_up(nullptr, nullptr);
clean_up();
state = std::make_unique<lua::state>();
conky::export_symbols(*state);
sleep(1); /* slight pause */
@ -1868,10 +1868,8 @@ void free_specials(special_t *&current) {
clear_stored_graphs();
}
void clean_up_without_threads(void *memtofree1, void *memtofree2) {
free_and_zero(memtofree1);
free_and_zero(memtofree2);
void clean_up(void) {
/* free_update_callbacks(); XXX: some new equivalent of this? */
free_and_zero(info.cpu_usage);
for (auto output : display_outputs()) output->cleanup();
conky::shutdown_display_outputs();
@ -1911,11 +1909,6 @@ void clean_up_without_threads(void *memtofree1, void *memtofree2) {
state.reset();
}
void clean_up(void *memtofree1, void *memtofree2) {
/* free_update_callbacks(); XXX: some new equivalent of this? */
clean_up_without_threads(memtofree1, memtofree2);
}
static void set_default_configurations() {
update_uname();
info.memmax = 0;

View File

@ -61,7 +61,7 @@ class obj_create_error : public std::runtime_error {
obj_create_error(const std::string &msg) : std::runtime_error(msg) {}
};
void clean_up(void *memtofree1, void *memtofree2);
void clean_up(void);
template <typename... Args>
inline void gettextize_format(const char *format, Args &&...args) {
@ -84,7 +84,9 @@ template <typename... Args>
inline void CRIT_ERR(void *memtofree1, void *memtofree2, const char *format,
Args &&...args) {
NORM_ERR(format, args...);
clean_up(memtofree1, memtofree2);
free(memtofree1);
free(memtofree2);
clean_up();
exit(EXIT_FAILURE);
}

View File

@ -359,7 +359,7 @@ int main(int argc, char **argv) {
return EXIT_FAILURE;
} catch (obj_create_error &e) {
std::cerr << e.what() << std::endl;
clean_up(nullptr, nullptr);
clean_up();
return EXIT_FAILURE;
} catch (std::exception &e) {
std::cerr << PACKAGE_NAME ": " << e.what() << std::endl;