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:
parent
863bd2441b
commit
19e779cdf9
15
src/conky.cc
15
src/conky.cc
@ -1828,7 +1828,7 @@ void main_loop() {
|
|||||||
|
|
||||||
llua_update_info(&info, active_update_interval());
|
llua_update_info(&info, active_update_interval());
|
||||||
}
|
}
|
||||||
clean_up(nullptr, nullptr);
|
clean_up();
|
||||||
|
|
||||||
#ifdef HAVE_SYS_INOTIFY_H
|
#ifdef HAVE_SYS_INOTIFY_H
|
||||||
if (inotify_fd != -1) {
|
if (inotify_fd != -1) {
|
||||||
@ -1850,7 +1850,7 @@ static void reload_config() {
|
|||||||
current_config.c_str(), getpid());
|
current_config.c_str(), getpid());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clean_up(nullptr, nullptr);
|
clean_up();
|
||||||
state = std::make_unique<lua::state>();
|
state = std::make_unique<lua::state>();
|
||||||
conky::export_symbols(*state);
|
conky::export_symbols(*state);
|
||||||
sleep(1); /* slight pause */
|
sleep(1); /* slight pause */
|
||||||
@ -1868,10 +1868,8 @@ void free_specials(special_t *¤t) {
|
|||||||
clear_stored_graphs();
|
clear_stored_graphs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clean_up_without_threads(void *memtofree1, void *memtofree2) {
|
void clean_up(void) {
|
||||||
free_and_zero(memtofree1);
|
/* free_update_callbacks(); XXX: some new equivalent of this? */
|
||||||
free_and_zero(memtofree2);
|
|
||||||
|
|
||||||
free_and_zero(info.cpu_usage);
|
free_and_zero(info.cpu_usage);
|
||||||
for (auto output : display_outputs()) output->cleanup();
|
for (auto output : display_outputs()) output->cleanup();
|
||||||
conky::shutdown_display_outputs();
|
conky::shutdown_display_outputs();
|
||||||
@ -1911,11 +1909,6 @@ void clean_up_without_threads(void *memtofree1, void *memtofree2) {
|
|||||||
state.reset();
|
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() {
|
static void set_default_configurations() {
|
||||||
update_uname();
|
update_uname();
|
||||||
info.memmax = 0;
|
info.memmax = 0;
|
||||||
|
@ -61,7 +61,7 @@ class obj_create_error : public std::runtime_error {
|
|||||||
obj_create_error(const std::string &msg) : std::runtime_error(msg) {}
|
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>
|
template <typename... Args>
|
||||||
inline void gettextize_format(const char *format, Args &&...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,
|
inline void CRIT_ERR(void *memtofree1, void *memtofree2, const char *format,
|
||||||
Args &&...args) {
|
Args &&...args) {
|
||||||
NORM_ERR(format, args...);
|
NORM_ERR(format, args...);
|
||||||
clean_up(memtofree1, memtofree2);
|
free(memtofree1);
|
||||||
|
free(memtofree2);
|
||||||
|
clean_up();
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ int main(int argc, char **argv) {
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
} catch (obj_create_error &e) {
|
} catch (obj_create_error &e) {
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
clean_up(nullptr, nullptr);
|
clean_up();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
std::cerr << PACKAGE_NAME ": " << e.what() << std::endl;
|
std::cerr << PACKAGE_NAME ": " << e.what() << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user