1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-14 19:39:47 +00:00

unconditionally call load_fonts()

Since load_fonts() iterates over font_count fonts which is initially -1,
it turns into a NOP when no fonts where added.
This commit is contained in:
Phil Sutter 2009-11-29 19:32:30 +01:00
parent 68a09f7a02
commit e5b25fd30a
2 changed files with 5 additions and 14 deletions

View File

@ -710,9 +710,6 @@ void generate_text_internal(char *p, int p_max_size,
struct text_object root, struct information *cur) struct text_object root, struct information *cur)
{ {
struct text_object *obj; struct text_object *obj;
#ifdef X11
int need_to_load_fonts = 0;
#endif /* X11 */
/* for the OBJ_top* handler */ /* for the OBJ_top* handler */
struct process **needed = 0; struct process **needed = 0;
@ -795,7 +792,6 @@ void generate_text_internal(char *p, int p_max_size,
#ifdef X11 #ifdef X11
OBJ(font) { OBJ(font) {
new_font(p, obj->data.s); new_font(p, obj->data.s);
need_to_load_fonts = 1;
} }
#endif /* X11 */ #endif /* X11 */
OBJ(text) { OBJ(text) {
@ -836,9 +832,7 @@ obj_loop_tail:
} }
#ifdef X11 #ifdef X11
/* load any new fonts we may have had */ /* load any new fonts we may have had */
if (need_to_load_fonts) {
load_fonts(); load_fonts();
}
#endif /* X11 */ #endif /* X11 */
} }

View File

@ -128,10 +128,6 @@ void free_fonts(void)
if ((output_methods & TO_X) == 0) { if ((output_methods & TO_X) == 0) {
return; return;
} }
if(fontloaded == 0) {
free(fonts);
return;
}
for (i = 0; i <= font_count; i++) { for (i = 0; i <= font_count; i++) {
#ifdef XFT #ifdef XFT
if (use_xft) { if (use_xft) {
@ -144,8 +140,10 @@ void free_fonts(void)
fonts[i].font = 0; fonts[i].font = 0;
} }
} }
if (fonts) {
free(fonts); free(fonts);
fonts = 0; fonts = 0;
}
font_count = -1; font_count = -1;
selected_font = 0; selected_font = 0;
#ifdef XFT #ifdef XFT
@ -198,5 +196,4 @@ void load_fonts(void)
} }
} }
} }
fontloaded = 1;
} }