drop a few unused fields from struct text_object
authorPhil Sutter <phil@nwl.cc>
Tue, 27 Oct 2009 00:15:30 +0000 (01:15 +0100)
committerPhil Sutter <phil@nwl.cc>
Tue, 3 Nov 2009 22:23:23 +0000 (23:23 +0100)
src/conky.c
src/core.c
src/iconv_tools.c
src/text_object.h

index 4d43416..f5c9fcb 100644 (file)
@@ -810,33 +810,37 @@ void generate_text_internal(char *p, int p_max_size,
                        }
 #endif /* !__OpenBSD__ */
                        OBJ(freq) {
-                               if (obj->a) {
-                                       obj->a = get_freq(p, p_max_size, "%.0f", 1,
+                               static int ok = 1;
+                               if (ok) {
+                                       ok = get_freq(p, p_max_size, "%.0f", 1,
                                                        obj->data.i);
                                }
                        }
                        OBJ(freq_g) {
-                               if (obj->a) {
+                               static int ok = 1;
+                               if (ok) {
 #ifndef __OpenBSD__
-                                       obj->a = get_freq(p, p_max_size, "%'.2f", 1000,
+                                       ok = get_freq(p, p_max_size, "%'.2f", 1000,
                                                        obj->data.i);
 #else
                                        /* OpenBSD has no such flag (SUSv2) */
-                                       obj->a = get_freq(p, p_max_size, "%.2f", 1000,
+                                       ok = get_freq(p, p_max_size, "%.2f", 1000,
                                                        obj->data.i);
 #endif /* __OpenBSD */
                                }
                        }
 #if defined(__linux__)
                        OBJ(voltage_mv) {
-                               if (obj->a) {
-                                       obj->a = get_voltage(p, p_max_size, "%.0f", 1,
+                               static int ok = 1;
+                               if (ok) {
+                                       ok = get_voltage(p, p_max_size, "%.0f", 1,
                                                        obj->data.i);
                                }
                        }
                        OBJ(voltage_v) {
-                               if (obj->a) {
-                                       obj->a = get_voltage(p, p_max_size, "%'.3f", 1000,
+                               static int ok = 1;
+                               if (ok) {
+                                       ok = get_voltage(p, p_max_size, "%'.3f", 1000,
                                                        obj->data.i);
                                }
                        }
@@ -2012,7 +2016,8 @@ void generate_text_internal(char *p, int p_max_size,
                                print_tailhead("head", obj, p, p_max_size);
                        }
                        OBJ(lines) {
-                               FILE *fp = open_file(obj->data.s, &obj->a);
+                               static int rep = 0;
+                               FILE *fp = open_file(obj->data.s, &rep);
 
                                if(fp != NULL) {
 /* FIXME: use something more general (see also tail.c, head.c */
@@ -2036,7 +2041,8 @@ void generate_text_internal(char *p, int p_max_size,
                        }
 
                        OBJ(words) {
-                               FILE *fp = open_file(obj->data.s, &obj->a);
+                               static int rep = 0;
+                               FILE *fp = open_file(obj->data.s, &rep);
 
                                if(fp != NULL) {
                                        char buf[BUFSZ];
index 1ded522..ad9fabb 100644 (file)
@@ -170,7 +170,6 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                } else {
                        obj->data.i = atoi(&arg[0]);
                }
-               obj->a = 1;
        END OBJ(freq_g, 0)
                get_cpu_count();
                if (!arg || !isdigit(arg[0]) || strlen(arg) >= 2 || atoi(&arg[0]) == 0
@@ -181,7 +180,6 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                } else {
                        obj->data.i = atoi(&arg[0]);
                }
-               obj->a = 1;
        END OBJ_ARG(read_tcp, 0, "read_tcp: Needs \"(host) port\" as argument(s)")
                parse_read_tcp_arg(obj, arg, free_at_crash);
 #if defined(__linux__)
@@ -195,7 +193,6 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                } else {
                        obj->data.i = atoi(&arg[0]);
                }
-               obj->a = 1;
        END OBJ(voltage_v, 0)
                get_cpu_count();
                if (!arg || !isdigit(arg[0]) || strlen(arg) >= 2 || atoi(&arg[0]) == 0
@@ -206,7 +203,6 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                } else {
                        obj->data.i = atoi(&arg[0]);
                }
-               obj->a = 1;
 
 #ifdef HAVE_IWLIB
        END OBJ(wireless_essid, &update_net_stats)
index 0c4912b..bf4a246 100644 (file)
@@ -128,7 +128,7 @@ void init_iconv_start(struct text_object *obj, void *free_at_crash, const char *
                if (new_iconv == (iconv_t) (-1)) {
                        NORM_ERR("Can't convert from %s to %s.", iconv_from, iconv_to);
                } else {
-                       obj->a = register_iconv(&new_iconv);
+                       obj->data.i = register_iconv(&new_iconv);
                        iconv_converting = 1;
                }
        }
@@ -142,7 +142,7 @@ void init_iconv_stop(void)
 void do_iconv_start(struct text_object *obj)
 {
        iconv_converting = 1;
-       iconv_selected = obj->a;
+       iconv_selected = obj->data.i;
 }
 
 void do_iconv_stop(void)
index fc1a9c9..4b51d70 100644 (file)
@@ -447,10 +447,7 @@ struct text_object {
 
        void *special_data;
        int type;
-       int a, b;
        long line;
-       unsigned int c, d, e;
-       char char_a, char_b;
 };
 
 /* text object list helpers */