1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

convert entropy_perc to callbacks.percentage

This commit is contained in:
Phil Sutter 2009-11-25 01:38:56 +01:00
parent 0631b2ab2e
commit 61c4efb305
3 changed files with 4 additions and 5 deletions

View File

@ -1375,7 +1375,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
END OBJ(entropy_avail, &update_entropy)
obj->callbacks.print = &print_entropy_avail;
END OBJ(entropy_perc, &update_entropy)
obj->callbacks.print = &print_entropy_perc;
obj->callbacks.percentage = &entropy_percentage;
END OBJ(entropy_poolsize, &update_entropy)
obj->callbacks.print = &print_entropy_poolsize;
END OBJ(entropy_bar, &update_entropy)

View File

@ -61,11 +61,10 @@ void print_entropy_avail(struct text_object *obj, char *p, int p_max_size)
snprintf(p, p_max_size, "%u", entropy.avail);
}
void print_entropy_perc(struct text_object *obj, char *p, int p_max_size)
uint8_t entropy_percentage(struct text_object *obj)
{
(void)obj;
percent_print(p, p_max_size, entropy.avail *
100 / entropy.poolsize);
return round_to_int((double)entropy.avail * 100.0 / (double)entropy.poolsize);
}
void print_entropy_poolsize(struct text_object *obj, char *p, int p_max_size)

View File

@ -34,7 +34,7 @@
void update_entropy(void);
void print_entropy_avail(struct text_object *, char *, int);
void print_entropy_perc(struct text_object *, char *, int);
uint8_t entropy_percentage(struct text_object *);
void print_entropy_poolsize(struct text_object *, char *, int);
uint8_t entropy_barval(struct text_object *);