1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-11 10:38:12 +00:00

drop a few unused fields from struct text_object

This commit is contained in:
Phil Sutter 2009-10-27 01:15:30 +01:00
parent d9ec45b25d
commit 7304378d73
4 changed files with 19 additions and 20 deletions

View 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];

View 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)

View 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)

View 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 */