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

Fix a small leak + some cleanup

This commit is contained in:
Pavel Labath 2010-11-13 19:40:43 +01:00
parent c9334eb071
commit 375e21af07
3 changed files with 7 additions and 25 deletions

View File

@ -182,9 +182,7 @@ int top_cpu, top_mem, top_time;
int top_io;
#endif
int top_running;
int output_methods;
static conky::simple_config_setting<bool> extra_newline("extra_newline", false, false);
enum x_initialiser_state x_initialised = NO;
static volatile int g_signal_pending;
/* Update interval */
@ -2491,11 +2489,6 @@ void clean_up_x11(void)
XDestroyRegion(x11_stuff.region);
x11_stuff.region = NULL;
}
if(display) {
XCloseDisplay(display);
display = NULL;
}
x_initialised = NO;
}
#endif
@ -2517,11 +2510,10 @@ void clean_up_without_threads(void *memtofree1, void* memtofree2)
free_and_zero(info.cpu_usage);
#ifdef BUILD_X11
if (x_initialised == YES) {
if(out_to_x.get(*state))
clean_up_x11();
}else{
else
fonts.clear(); //in set_default_configurations a font is set but not loaded
}
#endif /* BUILD_X11 */
if (info.first_process) {

View File

@ -319,16 +319,6 @@ extern conky::range_config_setting<unsigned int> max_user_text;
/* path to config file */
extern std::string current_config;
#define TO_STDERR 4
enum x_initialiser_state {
NO = 0,
YES = 1,
NEVER = 2
};
extern int output_methods;
extern enum x_initialiser_state x_initialised;
#define DEFAULT_TEXT_BUFFER_SIZE_S "##DEFAULT_TEXT_BUFFER_SIZE"
#define NOBATTERY 0

View File

@ -1036,13 +1036,13 @@ void get_x11_desktop_info(Display *current_display, Atom atom)
}
}
#define NOT_IN_X "Not running in X"
static const char NOT_IN_X[] = "Not running in X";
void print_monitor(struct text_object *obj, char *p, int p_max_size)
{
(void)obj;
if(x_initialised != YES) {
if(not out_to_x.get(*state)) {
strncpy(p, NOT_IN_X, p_max_size);
return;
}
@ -1053,7 +1053,7 @@ void print_monitor_number(struct text_object *obj, char *p, int p_max_size)
{
(void)obj;
if(x_initialised != YES) {
if(not out_to_x.get(*state)) {
strncpy(p, NOT_IN_X, p_max_size);
return;
}
@ -1064,7 +1064,7 @@ void print_desktop(struct text_object *obj, char *p, int p_max_size)
{
(void)obj;
if(x_initialised != YES) {
if(not out_to_x.get(*state)) {
strncpy(p, NOT_IN_X, p_max_size);
return;
}
@ -1075,7 +1075,7 @@ void print_desktop_number(struct text_object *obj, char *p, int p_max_size)
{
(void)obj;
if(x_initialised != YES) {
if(not out_to_x.get(*state)) {
strncpy(p, NOT_IN_X, p_max_size);
return;
}